Home » SQL & PL/SQL » SQL & PL/SQL » ORA-06530: Reference to uninitialized collection
ORA-06530: Reference to uninitialized collection [message #223375] Thu, 08 March 2007 13:21 Go to next message
Ivan
Messages: 180
Registered: June 2000
Senior Member
Guys,
Could you please help me with a collection problem I'm having?

Here's the code:

declare
   type r is record (dt date, n  pls_integer);
   type tr is table of r;
   type tt is table of tr;
   --
   lt tt := tt();
begin
   lt.extend;
   --
   -- Need to assign values to lt(1)(1)
/*
   lt(1).extend; -- returns    ORA-06531: Reference to uninitialized collection
*/
   null;
end;


The types are created using the CREATE TYPE command.

I need to be able to populate the LT collection one line/value at a time.
The problem is that I can't assign values to LT(1)(1) without initializing it first.

Could anyone show me how to do that, please?

Thank you in advance.
Re: ORA-06530: Reference to uninitialized collection [message #223415 is a reply to message #223375] Thu, 08 March 2007 16:39 Go to previous messageGo to next message
Barbara Boehmer
Messages: 8625
Registered: November 2002
Location: California, USA
Senior Member
SCOTT@10gXE> declare
  2  	type r is record (dt date, n  pls_integer);
  3  	type tr is table of r;
  4  	type tt is table of tr;
  5  	lt tt := tt();
  6  begin
  7    lt.extend;
  8    lt(1) := tr();
  9    lt(1).extend;
 10    lt(1)(1).dt := sysdate;
 11    lt(1)(1).n := 1;
 12    dbms_output.put_line (lt(1)(1).dt);
 13    dbms_output.put_line (lt(1)(1).n);
 14  end;
 15  /
08-MAR-07
1

PL/SQL procedure successfully completed.

SCOTT@10gXE>

Re: ORA-06530: Reference to uninitialized collection [message #223566 is a reply to message #223375] Fri, 09 March 2007 10:04 Go to previous message
Ivan
Messages: 180
Registered: June 2000
Senior Member
Thank you very much Barbara.
Previous Topic: Select statment required
Next Topic: authid
Goto Forum:
  


Current Time: Sat Dec 03 19:59:23 CST 2016

Total time taken to generate the page: 0.09250 seconds