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 and Cursors

Re: PL/SQL and Cursors

From: Martin Jesterhoudt <martinj_at_worldonline.nl>
Date: 1997/09/09
Message-ID: <34144c08.4134034@news.worldonline.nl>#1/1

On Wed, 03 Sep 1997 17:40:58 -0400, "Bryan J. Gentile" <bgentile_at_bdsinc.com> wrote:

>Is it possible with PL/SQL to nest a cursor within another cursor? If
>so, how can I do this, some sample code would be very beneficial.
>Thanks in advance. If possbile, can you email me a response as well as
>replying to this posted message?

declare

  cursor c1 is select * from dept;
  cursor c2 (v_deptno) is select * from emp where deptno = v_deptno;

begin

  for r1 in c1 loop
    for r2 in c2 (r1.deptno) loop   

    <do your thang!>

    end loop;
  end loop;

end;

I didn't have the Oracle book on my lap, so syntax errors may occur

;-)
-------------------------------------------------------------------------------
--- Martin Jesterhoudt                      
--- martinj(replace this by @)worldonline.nl
-------------------------------------------------------------------------------
Received on Tue Sep 09 1997 - 00:00:00 CDT

Original text of this message

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