Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: PL/SQL Help

Re: PL/SQL Help

From: Paul Davies <cobalt_at_dircon.co.uk>
Date: Tue, 8 Jun 1999 11:37:45 +0100
Message-ID: <375cf079@newsread3.dircon.co.uk>


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;

    end loop;
   end;

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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US