Informix Error -4438: You cannot SELECT into a substring of a character variable.
Cause and resolution
You cannot SELECT into a substring of a character variable.
Substring notation is not allowed in the INTO clause. You can specify a substring of a column in the list of columns to select and in the WHERE clause. But you have to select into an entire variable. Define a variable to select into, and move the data into the destination substring using a LET statement.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-4438 fires when a SELECT's INTO clause uses substring notation — per the official
guidance, substrings are allowed in the select-list and WHERE clause, but INTO must
receive an entire variable.
- Substring notation used in the
INTOclause of aSELECT, per the official guidance — the direct, only cause.
Solutions / Resolution
- Define a variable to select into as a whole, per the official guidance.
- Move the data into the destination substring afterward with a
LETstatement, per the official guidance.
Examples
Substring notation in INTO
SELECT order_ref INTO full_ref[1,5] FROM orders WHERE order_id = 1001;
-- -4438: INTO cannot target a substring
Corrected
SELECT order_ref INTO temp_ref FROM orders WHERE order_id = 1001;
LET full_ref[1,5] = temp_ref
Diagnostic Checks
- Check every
SELECT'sINTOclause for substring notation, and select into a whole variable instead, moving the value into the substring separately.
Related Errors / Related Topics
No closely related error codes are cross-referenced for -4438 in this set yet.
A SELECT's INTO clause uses substring notation, which isn't allowed — select into a whole
variable, then assign the substring separately.