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!

Oracle error ORA-06531: Reference to uninitialized collection While executing the block for record t

msAug 2 2022

Hi Everyone,
I am using Oracle version 12c.
I am getting the below error when i run the following code. It is contains a nested table variable inside a record variable. The table variable can have more then one rows and record variable can have more than one column.

set serveroutput on
declare
l_err_msg varchar2(4000);
    TYPE dc_code_tab_type IS TABLE OF varchar2(10);
    TYPE typ1 IS RECORD
    (
        dc_code     dc_code_tab_type
    );
   a_typ1 typ1;    
begin

a_typ1.dc_code.extend;
a_typ1.dc_code(1) := '15'; 

end;
/



Error report -
ORA-06531: Reference to uninitialized collection
ORA-06512: at line 18
06531. 00000 -  "Reference to uninitialized collection"
*Cause:    An element or member function of a nested table or varray
           was referenced (where an initialized collection is needed)
           without the collection having been initialized.
*Action:   Initialize the collection with an appropriate constructor
           or whole-object assignment.

Thanks
Gautam

This post has been answered by ms on Aug 2 2022
Jump to Answer
Comments
Post Details
Added on Aug 2 2022
2 comments
7,195 views