Informix Error -33054: Updates are not allowed on a scroll cursor.
Cause and resolution
Updates are not allowed on a scroll cursor.
This UPDATE statement refers to a cursor that was declared with the SCROLL keyword. The UPDATE statement requires a cursor that has been declared FOR UPDATE to ensure that the proper level of locking is applied to the rows that will be updated. See the DECLARE statement in the IBM Informix Guide to SQL: Syntax for more information on the correct use of cursors.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-33054 fires when an UPDATE statement refers to a cursor declared with SCROLL — per
the official guidance, UPDATE requires a cursor declared FOR UPDATE for proper
locking.
- An
UPDATEtargeting a cursor declaredSCROLL(withoutFOR UPDATE), per the official guidance — the direct, only cause.
Solutions / Resolution
- Declare the cursor
FOR UPDATE, per the official guidance, consulting theDECLAREentry in the IBM Informix Guide to SQL: Syntax.
Examples
An UPDATE against a SCROLL-only cursor
DECLARE upd_cur SCROLL CURSOR FOR SELECT total FROM orders;
OPEN upd_cur;
FETCH upd_cur INTO :amt;
UPDATE orders SET total = :amt * 2 WHERE CURRENT OF upd_cur;
-- -33054: upd_cur has no FOR UPDATE
Corrected
DECLARE upd_cur SCROLL CURSOR FOR SELECT total FROM orders FOR UPDATE;
Diagnostic Checks
- Check whether the targeted cursor's
DECLAREincludesFOR UPDATE, and add it if missing.
Related Errors / Related Topics
- -33039 — "Updates are not allowed in singleton select." A related cursor/
UPDATErestriction, on singletonSELECTs rather thanSCROLLcursors.
An UPDATE targeted a SCROLL cursor without FOR UPDATE — add FOR UPDATE to the
cursor's declaration.