Informix Error -2971: This column is not a character column, and therefore cannot be subscripted.
Cause and resolution
This column is not a character column, and therefore cannot be subscripted.
This statement contains a subscript, a pair of numbers in square brackets, after a column name. However, the data type of the column is not CHAR, VARCHAR, or TEXT. Only such columns can be subscripted. Check that you named the correct column. If you did, check its definition in the database.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-2971 fires when a column reference carries a subscript (bracketed number pair) but the
column's data type isn't CHAR, VARCHAR, or TEXT — per the official guidance, only those
character types can be subscripted.
- A subscript applied to a column that isn't
CHAR/VARCHAR/TEXT, per the official guidance — the direct, only cause.
Solutions / Resolution
- Check that the correct column was named, per the official guidance.
- If it was, check its definition in the database, per the official guidance — the column's actual type may differ from what was expected.
Examples
A subscript on a non-character column
ATTRIBUTES
partial_id = order_id[1,3];
-- -2971: order_id is INTEGER, not CHAR/VARCHAR/TEXT
Corrected
ATTRIBUTES
partial_ref = order_ref[1,3];
-- order_ref is CHAR(10)
Diagnostic Checks
- Check the data type of any subscripted column, and confirm it's
CHAR,VARCHAR, orTEXT.
Related Errors / Related Topics
- -2870 — "The subscripted column size does not match the space allocated in the display field." A related column-substring error, about a size mismatch on a valid character-column subscript, rather than subscripting a non-character column at all.
A subscript is applied to a column that isn't CHAR/VARCHAR/TEXT — check the column name
and its actual database type.