Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: PL/SQL Help
OK. I got round the problem of initialisation by initialising the empty
array. And I'm now using table collections. But when I run the following
code
cursor c1 is select * from TABLE_A;
type myarray is table of TABLE_A.COL_A%type;
thearray myarray := myarray();
i int := 1;
begin
for c1_rec in c1 loop
thearray(i) = c1_rec.COL_A; i := i + 1;
I get a "Subscript beyong count" error (TABLE_A contains about 20 rows)
Please help!!
Paul Davies wrote in message <375ce91c_at_newsread3.dircon.co.uk>...
>How do I insert the values returned by a select into a varray.
>
>So, I have a table, TABLE and I want to select COL_A and insert into the
>varray:
>
>cursor c1 is select * from TABLE
>type myarray is varray(100) of TABLE.COL_A%TYPE;
>
>thearray myarray;
> i int := 1;
>
>begin
> for c1_rec in c1 loop
> thearray(i) = c1_rec.COL_A /*this is what I want to do, but it
>does not compile*/
> i := i + 1;
> end loop;
>end;
>
>
Received on Tue Jun 08 1999 - 05:37:45 CDT
![]() |
![]() |