Informix Error -277
-277 UPDATE table table-name is not the same as the cursor table.
This UPDATE WHERE CURRENT OF cursor statement refers to a different table than the table referenced by the SELECT statement that was declared with the cursor. Review the program logic to make sure that an update through a cursor updates only the table that the cursor is reading. This message also applies to cursor statements that use DELETE WHERE CURRENT OF.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-277 is a clear, specific mismatch: an UPDATE ... WHERE CURRENT OF cursor-name (or the
equivalent DELETE) named a different table than the one the cursor's SELECT was actually
declared against.
- A copy-paste error — a cursor declared against one table reused with an
UPDATE/DELETEstatement that mistakenly names a different, perhaps similarly-structured table. - Confusion in code with several similar cursors declared against different tables, where
the wrong table name ends up in the
UPDATE/DELETE WHERE CURRENT OFstatement. - A refactor that changed the cursor's underlying table without updating the corresponding
WHERE CURRENT OFstatement to match.
Solutions / Resolution
- Review program logic to ensure the
UPDATE/DELETE WHERE CURRENT OFstatement targets the same table the cursor'sSELECTwas declared against, per the official guidance. - Correct the table name in the
UPDATE/DELETEstatement to match the cursor's actual underlying table.
Examples
The mismatch
DECLARE cur1 CURSOR FOR SELECT * FROM orders WHERE status = 'pending' FOR UPDATE;
OPEN cur1;
FETCH cur1 INTO :rec;
UPDATE order_items SET processed = 't' WHERE CURRENT OF cur1;
-- -277: cur1 was declared against "orders", not "order_items"
Fix:
UPDATE orders SET status = 'processing' WHERE CURRENT OF cur1;
Diagnostic Checks
- Compare the table named in the cursor's
DECLARE ... SELECTagainst the table named in the failingUPDATE/DELETE WHERE CURRENT OFstatement — the mismatch is always directly visible once both are placed side by side.
Related Errors / Related Topics
- -266 — "There is no current row for UPDATE/DELETE cursor." Another
WHERE CURRENT OFrelated condition, though about fetch state rather than table matching. - -207 — "Cannot update cursor declared on more than one table. / Cannot declare a SELECT INTO statement FOR UPDATE." Another cursor-declaration restriction in the same general family.
Compare the cursor's declared table against the UPDATE/DELETE statement's table directly —
the mismatch is always exactly this simple once both are placed side by side.