Informix Error -1332
-1332 A character variable has referenced subscripts that are out of range.
In the current statement, a variable that is used in taking a substring of a character value contains a number less than one or a number greater than the size of the variable, or the first substring expression is larger than the second. Review the program logic that leads up to this statement to find the cause of the error.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-1332 fires when a substring operation on a character variable references positions that don't exist — per the official guidance, this happens when a subscript is less than 1 or exceeds the variable's length, or when the first substring position is larger than the second.
- A subscript less than 1 or greater than the variable's length, per the official guidance — the direct, common cause.
- The first substring position larger than the second, per the official guidance's other named cause — an inverted range.
Solutions / Resolution
- Review the program logic preceding this statement, per the official guidance, to verify substring indices fall within valid bounds (1 to the variable's length).
- Confirm the start position doesn't exceed the end position, per the official guidance.
Examples
An inverted substring range
DEFINE v_status CHAR(10);
LET v_status = "pending";
DISPLAY v_status[5,2];
-- -1332: start position 5 is greater than end position 2
Corrected
DISPLAY v_status[2,5];
Diagnostic Checks
- Check both substring positions against the variable's actual length, and confirm the start position doesn't exceed the end position.
Related Errors / Related Topics
- -1326 — "An array variable has been referenced outside of its specified dimensions." A related out-of-bounds error, for array subscripts rather than character-variable substring positions.
A substring position is out of range or inverted (start > end) — check both positions against the variable's actual length.