Home > Net >  ORA-06530: Reference to uninitialized composite - Similar questions review but still unclear
ORA-06530: Reference to uninitialized composite - Similar questions review but still unclear

Time:09-04

I'm getting this error

Error while executing the procedure : ORA-06530: Reference to uninitialized composite

This is probably a common error for Oracle newbies like me. I looked at similar posts but can't figure out how to apply the answers to my code, which follows. Your patience and help would be appreciated.

I have a table of

CREATE OR REPLACE TYPE "FDS_APPS"."TY_AUDIT_COL_TBL" IS
    TABLE OF fds_apps.ty_audit_col_obj;

of this TYPE

CREATE OR REPLACE TYPE "FDS_APPS"."TY_AUDIT_COL_OBJ" AS OBJECT (
    application   VARCHAR2(30),
    module        VARCHAR2(30),
    created_by    VARCHAR2(50),
    creation_date DATE
);  

I want to create a a test procedure to call the following procedure while passing in the input values with focus, of course on the p_audit_col parameter of type ty_audit_col_tbl.

PROCEDURE check_mv_status (
    o_outcome_type OUT VARCHAR2,
    p_audit_col    IN fds_apps.ty_audit_col_tbl,
    p_refresh_ind  IN CHAR DEFAULT 'N',
    p_mv_result    OUT NOCOPY fds_apps.ty_result_tbl
) AS...

here is my calling procedure.

CREATE OR REPLACE PROCEDURE FDS_APPS.JUNKPROC2 
AS
  O_OUTCOME_TYPE    VARCHAR2(32767);  
  P_AUDIT_COL       TY_AUDIT_COL_TBL;
  P_REFRESH_IND     CHAR;
  P_MV_RESULT       TY_RESULT_TBL;  
BEGIN

  P_AUDIT_COL       := fds_apps.TY_AUDIT_COL_TBL();
  P_AUDIT_COL.extend(1);

   --Error occurs on the following line
  P_AUDIT_COL(1).application := 'App';
  P_AUDIT_COL(1).module      := 'Module';
  P_AUDIT_COL(1).created_by  := 'MyID';

  P_REFRESH_IND := 'N';

  FIRM_RTBI_PKG.CHECK_MV_STATUS(O_OUTCOME_TYPE, P_AUDIT_COL, P_REFRESH_IND, P_MV_RESULT);

  dbms_output.put_line('O_OUTCOME_TYPE=' || O_OUTCOME_TYPE);
END;
/

I get the error where indicated as a comment, when I try to assign a value to an element in the 1 record collection.

Could you advise on how I overcome this error?

CodePudding user response:

The syntax you are showing is for populating RECORDS, which is different than populating an OBJECT type.

Replace this:

  P_AUDIT_COL(1).application := 'App';
  P_AUDIT_COL(1).module      := 'Module';
  P_AUDIT_COL(1).created_by  := 'MyID';

with this:

  P_AUDIT_COL(1) := TY_AUDIT_COL_OBJ('App','Module','MyID',sysdate);

An object type variable needs to be initialized with a constructor

  • Related