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

Home -> Community -> Mailing Lists -> Oracle-L -> Nesting cursors

Nesting cursors

From: Thomas Day <tomday2_at_gmail.com>
Date: Tue, 18 Oct 2005 11:49:51 -0400
Message-ID: <a8c504590510180849n64031f14t9372bb78383ad07@mail.gmail.com>


Maybe what I'm trying to do isn't legal in PL/SQL. In any case, the documentation that I've read hasn't been helpful. So far the general form of what I've written is:
 PROCEDURE AAA IS
 CURSOR (collect events);
BEGIN
 FOR EVENTRECORD IN EVENTS(EVENT_ID) LOOP --loop 1 DECLARE

 CURSOR A (collect A facts);
 CURSOR B (collect B facts);
 CURSOR C (collect C facts);

BEGIN
 FOR ARECORD IN A(fact_id) LOOP -- loop 2  build an output array based on ARECORD;  END LOOP; -- loop 2
END;
BEGIN
 FOR EVENTRECORD IN EVENTS(EVENT_ID) LOOP --loop 3  CURSOR D (collect D facts);
 --build an output array trying to coorelate B, C, and D facts (if there' s no cooreleation then B and C are null)
 OPEN CURSOR B and test for coorelation; CLOSE CURSOR B;  OPEN CURSOR C and test for coorelation; CLOSE CURSOR C:  build an output array based on DRECORD correlated with B & C;  END LOOP; --loop3
END;
END LOOP; -- loop 1
END;
 The errors that I'm getting are from
 OPEN CURSOR B and test for coorelation; CLOSE CURSOR B;  OPEN CURSOR C and test for coorelation; CLOSE CURSOR C:  The errors that I'm getting are on the OPEN CURSOR B (and C) and CLOSE.   PLS-00201: identifier 'B' must be declared  PLS-00201: identifier 'C' must be declared  Can anyone see what I'm doing wrong? I've tried adding extra DECLAREs but that hasn't done the trick.
--
http://www.freelists.org/webpage/oracle-l
Received on Tue Oct 18 2005 - 10:54:15 CDT

Original text of this message

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