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.