Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

ORA-06530 Reference to uninitialized composite: Can't figure this one out.

461055Oct 28 2005 — edited Oct 28 2005
Given:

create or replace TYPE msgRecordTyp IS OBJECT (
r_msgid VARCHAR2(50),
r_trackid VARCHAR2(50)
);
/
create or replace TYPE msgTableArrayTyp AS
VARRAY(1000) OF msgRecordTyp;
/

declare
msgTab msgTableArrayTyp;
v_msgid varchar2(20) := 'msgid value';
v_trackid varchar2(20) := 'trackid value';
begin
msgTab := msgTableArrayTyp( msgRecordTyp(null, null) );
msgTab.extend;
msgTab(1).r_msgid := v_msgid;
msgTab(1).r_trackid := v_trackid;
dbms_output.put_line( msgTab(1).r_msgid );
--
msgTab.extend;
msgTab(2).r_msgid := v_msgid;
msgTab(2).r_trackid := v_trackid;
dbms_output.put_line(msgTab(2).r_msgid);
end;

I get:
pbrelin@DVDW.WORLD> /
msgid value
declare
*
ERROR at line 1:
ORA-06530: Reference to uninitialized composite
ORA-06512: at line 13

Notice the first assignment of the collection works. It fails on the second attempt....

Anyone know what I'm doing wrong?

Thanks in advance.
Paul
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 25 2005
Added on Oct 28 2005
1 comment
2,725 views