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: ORA-01001: invalid cursor

583872Feb 26 2008 — edited Feb 27 2008
Hi,

I am writing a procedure which fetches from a cursor, closes the cursor and then does something with the results.

First I call another procedure which returns me the cursor.
I then try to fetch from the cursor using:

LOOP
FETCH l_resultset BULK COLLECT INTO tag_result_rec;
EXIT WHEN l_resultset%NOTFOUND;
END LOOP;

This is where the error is being raised. I first thought that the procedure which brings me back the resultset may not be passing back the cursor open. I checked and found that the procedure was opening the cursor and ran through to the end. This procedure does not close the cursor.

I then inserted the following check to see if the cursor was open before the fetch I am trying above.

IF l_resultset%ISOPEN THEN
dbms_output.put_line('test 1');
END IF;

When running the procedure, the output message did print so the cursor is open.

So any explanations as to why the invalid cursor is being raised?

Thanks in advance for any assistance.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 26 2008
Added on Feb 26 2008
12 comments
5,465 views