Informix Error -616
-616 A TEXT or BYTE subscript is not allowed within this context.
This UPDATE or INSERT statement specifies a subscripted column of BYTE or TEXT data type as a destination. Subscript notation is not allowed in this context; a BYTE or TEXT (or any other) value must be replaced in full. Revise the statement to assign into whole columns.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-616 fires when an UPDATE/INSERT statement's destination is a subscripted TEXT/BYTE
column (column[start,end]) — per the official guidance, subscript notation is only for reading
a portion of a value, not for writing to it; a TEXT/BYTE (or any other) value must be replaced
in full.
- An
UPDATEtargeting a subscriptedTEXT/BYTEcolumn — per the official guidance, the direct, only cause, treating subscript notation as if it supported partial writes the way it supports partial reads. - A misunderstanding carried over from a language/database where substring assignment is
supported, applied to Informix
TEXT/BYTEcolumns where it isn't.
Solutions / Resolution
- Revise the statement to assign into the whole column, per the official guidance — replace
the entire
TEXT/BYTEvalue rather than a subscripted portion of it. - If only part of the value genuinely needs to change, read the full current value out, modify it at the application level, and write the complete new value back as a whole-column assignment.
Examples
The disallowed attempt
UPDATE documents SET content[1,10] = 'newvalue' WHERE doc_id = 1;
-- -616: subscript notation isn't allowed as an UPDATE destination
Corrected — whole-column assignment
UPDATE documents SET content = 'newvalue' || content[11,500]
WHERE doc_id = 1;
(reading a subscript on the right-hand side, to build the full replacement value, is fine — it's
only the destination side of the assignment that can't be subscripted. Note LENGTH() itself
doesn't apply to TEXT/BYTE values, per -575, so an application reading the value's actual
length needs to do so through the client library rather than in SQL.)
Diagnostic Checks
- Check whether the subscript notation appears on the destination (left) side of an
assignment, in an
UPDATE ... SETorINSERT, versus the source (right) side where it's allowed.
Related Errors / Related Topics
- -607 — "Text/Byte subscript error." A related error about subscript syntax itself being malformed, rather than subscript notation being used somewhere it isn't allowed at all.
Subscript notation reads a portion of a value but can't write one — always assign into the whole column.