Informix Error -26052: OPEN attempted on already opened cursor (%s)
Cause and resolution
OPEN attempted on already opened cursor (%s)
This OPEN statement referenced a cursor that has already been opened. Review the program logic, and CLOSE the cursor before attempting to reopen it.
Example below makes sure to CLOSE the cursor before trying to OPEN the same cursor with different input parameter values:
Example
OPEN c_emp USING lgivenname; ... CLOSE c_emp; OPEN c_emp USING lfamilyname; ... CLOSE c_emp;
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-26052 fires when OPEN is issued on a cursor that's already open — per the official
guidance.
- The
OPENstatement's cursor was already opened and not yet closed, per the official guidance — the direct, only cause.
Solutions / Resolution
CLOSEthe cursor before reopening it, per the official guidance.
Examples
Reopening a cursor with different parameters
OPEN c_emp USING lgivenname;
...
CLOSE c_emp;
OPEN c_emp USING lfamilyname;
...
CLOSE c_emp;
Diagnostic Checks
- Check the program logic for an
OPENon a cursor without an interveningCLOSE, and add the missingCLOSE.
Related Errors / Related Topics
- -26053 — "FETCH or CLOSE cannot reference cursor (%s) that is not opened" The mirror- image error, using an unopened cursor rather than reopening an already-open one.
- -26054 — "Cannot FREE a cursor (%s) that is in use" A related cursor-lifecycle error, on freeing a still-open cursor rather than reopening one.
OPEN was issued on a cursor that's already open — CLOSE it first.