Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: How to create a 2-D array inside a package
In article <3BB46380.E6DD5A3F_at_hollomey.com>, Markus says...
>
>2 things:
>a. which version of oracle?
>
>if 8i or higher:
>RTFM (read the f****** manual)
I always thought that was "read that fine manual"
I think you mean 9I or higher as collections of collections (what they are looking for) is a new 9i feature, not available in 8i and before. In 9i, you can:
create type array1_type as table of number
/
create type array2_type as table of array1_type
/
create type array3_type as table of array2_type
/
and then:
declare
l_array1 array1_type := array1_type(); l_array2 array2_type := array2_type(); l_array3 array3_type := array3_type();begin
l_array1 := array1_type( 1, 2, 3 );
l_array2 := array2_type( l_array1, l_array1 );
l_array3 := array3_type( l_array2, l_array2, l_array2, l_array2 );
insert into t values ( 1, l_array1, l_array2, l_array3 );
for i in 1 .. l_array3.count
loop
for j in 1 .. l_array3(i).count loop for k in 1 .. l_array3(i)(j).count loop dbms_output.put_line ( 'l_array3(' || i || ',' || j || ',' || k || ') = ' || l_array3(i)(j)(k) ); end loop; end loop;
having in effect a multi-dimensional array.
>on "Collections and Records"
>there you might find everything you need
>
>C Chang wrote:
>
>> I like to use the input data to create a run time 2-D array. The only
>> thing I know is to something like
>>
>> variable_ref(count) which is a 1D array.
>>
>> Can Any guru give a tip? Thanks
>>
>> CC
>
-- Thomas Kyte (tkyte@us.oracle.com) http://asktom.oracle.com/ Expert one on one Oracle, programming techniques and solutions for Oracle. http://www.amazon.com/exec/obidos/ASIN/1861004826/ Opinions are mine and do not necessarily reflect those of Oracle CorpReceived on Mon Oct 01 2001 - 05:55:43 CDT
![]() |
![]() |