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

Home -> Community -> Usenet -> c.d.o.server -> Re: Nested queries in function

Re: Nested queries in function

From: <buurd_at_my-deja.com>
Date: Fri, 26 Nov 1999 09:22:37 GMT
Message-ID: <81ljgr$1ho$1@nnrp1.deja.com>


Thanks for your answer but there is one detail left... I want to collect all the results form the inner loop into something I can return from the function. I'd learnd from another question here that I can return a cursor but how do I collect the results from the inner loop to that cursor??

Tia
Roland
> Use 2 cursors with the second one using an input parameter :
> declare
> cursor c1 is select toto from table1;
> hv_toto table1.toto%TYPE;
> cursor c2 (in_toto table1.toto%TYPE) is
> select tata from table2 where toto_id = in_toto;
> hv_tata table2.tata%TYPE;
> begin
> open c1;
> loop
> fetch c1 into hv_toto;
> exit when c1%NOTFOUND;
> open c2(hv_toto);
> loop
> fetch c2 into hv_tata;
> exit when c2%NOTFOUND;
> -- do what U want with c2 :)
> end loop;
> close c2;
> end loop;
> close c1;
> end;
>
> best regards,
>
> aymeric barantal (mric)
> dba @ grolier interactive europe
>
>

--
Roland Carlsson
Certified Java programmer
Skövde
Sweden

Sent via Deja.com http://www.deja.com/
Before you buy. Received on Fri Nov 26 1999 - 03:22:37 CST

Original text of this message

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