Home » SQL & PL/SQL » SQL & PL/SQL » Initializing a varray collection of records
Initializing a varray collection of records [message #39395] Sun, 14 July 2002 13:23 Go to next message
IndyWest
Messages: 6
Registered: July 2002
Junior Member
Howdy Group,

Could someone point me out as to what I have to do here? Oracle gives me a ORA-6531 error as I am not initializing the contents of a variable array. Question, how do I initialize a varray of records?

My code looks like this:
==================
Type rec1 Is Record (Col1 Number, Col2 Number);
Type arr1 is Varray(100) of rec1;

arrTest arr1;
==================

Tried initializing arrTest using the following (loop-wise) to no avail:

a. arrTest(0):= arr1(1, 1);
b. arrTest(0).Col1:= 0;
arrTest(0).Col2:= 0;
c. Fetch cur_Test Into arrTest(0);

Thanks for the help,
IW.
Re: Initializing a varray collection of records [message #39403 is a reply to message #39395] Mon, 15 July 2002 08:39 Go to previous messageGo to next message
Todd Barry
Messages: 4819
Registered: August 2001
Senior Member
declare
  type rec1 is record (col1 number, col2 number);
  type arr1 is varray(100) of rec1;
  arrtest arr1 := arr1();  -- note initialization here
begin
  arrtest.extend;
  arrtest(1).col1 := 1;
  arrtest(1).col2 := 2;
end;
Re: Initializing a varray collection of records [message #39412 is a reply to message #39395] Mon, 15 July 2002 16:46 Go to previous message
IndyWest
Messages: 6
Registered: July 2002
Junior Member
Fantastic! Thanks a million, Todd.
Previous Topic: Problem with index
Next Topic: Applications accessibility
Goto Forum:
  


Current Time: Wed Aug 06 16:56:01 CDT 2025