Informix Error -1828: Cannot use scroll or hold cursor with client collections.
Cause and resolution
Cannot use scroll or hold cursor with client collections.
A cursor declaration for a client collection cannot be for a scroll or hold cursor, as in the following declarations:
/** scroll cursor case **/ EXEC SQL DECLARE cur1 SCROLL CURSOR FOR SELECT * FROM table(:collection_host_variable);
/** hold cursor case **/ EXEC SQL DECLARE cur2 CURSOR WITH HOLD FOR SELECT * FROM table(:collection_host_variable);
Declare the cursor as follows instead:
EXEC SQL DECLARE cur3 CURSOR FOR SELECT * FROM table(:collection_host_variable);
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-1828 fires when a SCROLL or WITH HOLD cursor is declared for a client collection — per the
official guidance, client collections don't support these cursor types.
- A cursor declared
SCROLLorWITH HOLDfor a collection host variable, per the official guidance — the direct, only cause.
Solutions / Resolution
- Declare a standard cursor without
SCROLLorWITH HOLDwhen working with collection host variables, per the official guidance.
Examples
A SCROLL cursor over a client collection host variable
collection *my_coll;
EXEC SQL DECLARE cur1 SCROLL CURSOR FOR
SELECT * FROM TABLE(:my_coll);
-- -1828: SCROLL isn't supported for a cursor over a client collection
-- host variable (via the TABLE(:var) derived-table syntax)
Corrected
collection *my_coll;
EXEC SQL DECLARE cur1 CURSOR FOR
SELECT * FROM TABLE(:my_coll);
Diagnostic Checks
- Check whether the cursor is declared
SCROLL/WITH HOLDand whether it involves a collection host variable, and drop those keywords if so.
Related Errors / Related Topics
No closely related error codes are cross-referenced for -1828 in this set yet.
SCROLL/WITH HOLD cursors aren't supported for client collections — declare a standard
cursor instead.