Informix Error -488
-488 Invalid operation on cursor.
An invalid operation has been attempted on a cursor. A cursor declared for a SELECT statement cannot be used in a PUT statement. Similarly, a cursor declared for an INSERT statement cannot be used in a FETCH statement. Check the program, and try again.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-488 is a general mismatch between a cursor's declared statement type and the operation being
performed on it: a SELECT-based cursor doesn't support PUT (which is for insert cursors), and
an INSERT-based cursor doesn't support FETCH (which is for select cursors) — each operation
only makes sense for the statement type the cursor was actually declared with.
- Calling
PUTon a cursor declared for aSELECTstatement —PUTis exclusively for insert cursors. - Calling
FETCHon a cursor declared for anINSERTstatement —FETCHis exclusively for select cursors. - Confusing which cursor variable corresponds to which declared statement, in code managing multiple cursors of different kinds.
Solutions / Resolution
- Check the program and confirm the operation matches the cursor's declared statement type,
per the official guidance —
PUTfor insert cursors,FETCHfor select cursors, never mixed. - Review variable naming if multiple cursors are in play, to rule out a mix-up between an insert cursor and a select cursor.
Examples
The disallowed PUT on a select cursor
DECLARE curs1 CURSOR FOR SELECT * FROM orders;
OPEN curs1;
PUT curs1 FROM :ord_id, :cust_id;
-- -488: curs1 is a SELECT cursor; PUT isn't valid on it
The disallowed FETCH on an insert cursor
DECLARE curs2 CURSOR FOR INSERT INTO orders (order_id, customer_id) VALUES (?, ?);
OPEN curs2;
FETCH curs2;
-- -488: curs2 is an INSERT cursor; FETCH isn't valid on it
Diagnostic Checks
- Check the
DECLAREstatement for the cursor named in the failing operation and confirm its statement type (SELECTvs.INSERT). - Review variable naming if multiple cursors are in play, to rule out a mix-up.
Related Errors / Related Topics
- -417 — "FLUSH can only be used on an insert cursor." The closely related sibling
restriction —
FLUSHis another insert-cursor-only operation, in the same family asPUT. - -413 — "Insert attempted on unopen cursor." A related insert-cursor error, about open/close state rather than a statement-type mismatch.
Match the operation to the cursor's declared statement type — PUT/FLUSH for insert cursors,
FETCH for select cursors, never mixed.