Invalid Cursor States

Invalid cursor states occur when a fetch uses a cursor that is not currently open, or an update where current of or delete where current of affects a cursor row that has been either modified or deleted, or not been fetched.

Message

Value

Description

Attempt to use cursor cursor_name which is not open. Use the system stored procedure sp_cursorinfo for more information.

24000

Occurs when an attempt is made to fetch from a cursor that has never been opened or that was closed by a commit statement or an implicit or explicit rollback. Reopen the cursor and repeat the fetch.

Cursor cursor_name was closed implicitly because the current cursor position was deleted due to an update or a delete. The cursor scan position could not be recovered. This happens for cursors which reference more than one table.

24000

Occurs when the join column of a multitable cursor has been deleted or changed. Issue another fetch to reposition the cursor.

The cursor cursor_name had its current scan position deleted because of a DELETE/UPDATE WHERE CURRENT OF or a regular searched DELETE/UPDATE. You must do a new FETCH before doing an UPDATE or DELETE WHERE CURRENT OF.

24000

Occurs when a user issues an update/delete where current of whose current cursor position has been deleted or changed. Issue another fetch before retrying the update/delete where current of.

The UPDATE/DELETE WHERE CURRENT OF failed for the cursor cursor_name because it is not positioned on a row.

24000

Occurs when a user issues an update/delete where current of on a cursor that:
  • Has not yet fetched a row

  • Has fetched one or more rows after reaching the end of the result set