Quick Search:
 The Oracle INVALID_CURSOR Exception - ORA-01001      [Return To Index] Jump to:  


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.

  1. Make sure you have an OPEN statement prior to using any explicit cursors.
  2. Make sure that you do not have a misplaced CLOSE statement.
  3. 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.
  4. 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
  5. 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.

Related Links:
   Home |    Search |    Code Library |    Sponsors |    Privacy |    Terms of Use |    Contact Us © 2003 - 2024 psoug.org