The INVALID_CURSOR Exception (ORA-01001) occurs when a program attempts a cursor operation that is not allowed, such as closing an unopened cursor. It may also be caused by the value of the MAXOPENCURSORS configuration option in the precompiler command being too small.
- Make sure you have an OPEN statement prior to using any explicit cursors.
- Make sure that you do not have a misplaced CLOSE statement.
- If you need to do a sequence of OPEN...CLOSE...OPEN...CLOSE (perhaps because you need to reset bind variables or to commit updates inside a loop) check your logic flow and make sure there are no fetches between the 1st CLOSE and the 2nd OPEN.
- If you have nested loops, check that a condition in an inner loop is not being missed which allows control to pass unexpectedly to a CLOSE in an outer loop
- Remember that a PL/SQL FOR loop does an implicit OPEN and CLOSE. If you take a routine with a FOR loop and change it to a WHILE loop you must remember to code the OPEN and CLOSE.
Note that according to Oracle's documentation, the ORA-01001 error no longer exists in Oracle 10g.