Re: Cursor Value used in another Cursor SELECT
From: Job Miller <jobmiller_at_yahoo.com>
Date: 4 Jun 2002 11:42:36 -0700
Message-ID: <2edf8ed9.0206041042.76a61bd8_at_posting.google.com>
Date: 4 Jun 2002 11:42:36 -0700
Message-ID: <2edf8ed9.0206041042.76a61bd8_at_posting.google.com>
cursors can accept parameters.
define your second cursor to accept a parameter and use the result
from your first fetch as the parameter to your first.
nResId int;
nId int;
cursor myCursor is select lId from FDMSeg where lId is not null; cursor myCursor2(p_nId int) is select lResId from FDMRes where lResId = p_nId;
BEGIN
open myCursor;
fetch myCursor into nId;
OPEN myCursor2(lId);
fetch myCursor2 into nResId;
close myCursor;
close myCursor2;
see docs at:
http://technet.oracle.com/docs/products/oracle9i/doc_library/release2/appdev.920/a96624/06_ora.htm#36656
for 9i example Received on Tue Jun 04 2002 - 20:42:36 CEST