From: martinj@worldonline.nl (Martin Jesterhoudt)
Subject: Re: PL/SQL and Cursors
Date: 1997/09/09
Message-ID: <34144c08.4134034@news.worldonline.nl>#1/1
References: <340DD969.C2B457F8@bdsinc.com>
Organization: World Online
Newsgroups: comp.databases.oracle.misc



On Wed, 03 Sep 1997 17:40:58 -0400, "Bryan J. Gentile"
<bgentile@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
-------------------------------------------------------------------------------


