Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Error closing cursor

894559Jul 13 2012 — edited Jul 13 2012
I've got a sql query that's using a cursor, everything works ok, until I uncomment out the line that's supposed to close the cursor.

DECLARE NextId NUMBER;
BEGIN
DECLARE CURSOR mytable_cursor
IS
SELECT myid
,value
FROM mytable;
BEGIN
FOR mytable_rec IN mytable_cursor
LOOP
-- do a select into NextId

-- do some more stuff

--do some more stuff

IF mytable_rec.value IS NOT NULL THEN
--do some more stuff
END IF;


END LOOP;
END;
-- CLOSE mytable_cursor;
END;

I've tried moving it after the final END and just after the END LOOP, but I always get an error. With the CLOSE at the location show here I get an error similar to:

Error report:
ORA-06550: line 70, column 7:
PLS-00201: identifier 'mytable_cursor' must be declared
ORA-06550: line 70, column 1:
PL/SQL: SQL Statement ignored
06550. 00000 - "line %s, column %s:\n%s"
*Cause: Usually a PL/SQL compilation error.
*Action:
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 10 2012
Added on Jul 13 2012
3 comments
560 views