Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

ORA-06530: Reference to uninitialized composite – Similar questions review but still unclear

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

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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?

>Solution :

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

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading