Informix Error -8116: Illegal subscripting in ORDER BY command.
Cause and resolution
Illegal subscripting in ORDER BY command.
You can only subscript a character field. Check the subscripts. No negative numbers are allowed; the numbers must fall within the length of the character column; and the first number must be less than or equal to the second number.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-8116 fires when an ORDER BY column subscript is invalid — per the official guidance, only
character fields can be subscripted, and the subscript values must be valid.
- A subscript applied to a non-character column, per the official guidance — the first named case.
- A negative subscript number, per the official guidance — the second named case.
- A subscript number outside the column's length, per the official guidance — the third named case.
- The first subscript number greater than the second, per the official guidance — the fourth named case.
Solutions / Resolution
- Check the subscripts, per the official guidance, and confirm they're non-negative, within the character column's length, with the first number less than or equal to the second.
Examples
An invalid ORDER BY subscript
ORDER BY customer_name[5,2]
-- -8116: the first number (5) exceeds the second (2)
Corrected
ORDER BY customer_name[2,5]
Diagnostic Checks
- Check every subscripted
ORDER BYcolumn, and confirm it's a character column with valid, correctly ordered subscript bounds.
Related Errors / Related Topics
- -8115 — "There may be no more than 8 sort columns specified in the ORDER BY command."
A related
ORDER BYrestriction, about the total column count rather than subscript validity.
An ORDER BY column's subscript is invalid — check that it's a character column with valid,
correctly ordered bounds.