Informix Error -575: LENGTH() requires string type values.
Cause and resolution
LENGTH() requires string type values.
This statement contains a use of LENGTH that is applied to a column or an expression that is not a character type (not CHAR or VARCHAR). This action is not supported. Review the uses of LENGTH, and make sure they apply only to character values.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-575 fires when LENGTH() is applied to a column or expression whose type isn't a character type
(CHAR/VARCHAR) — per the official guidance, LENGTH only accepts character values.
LENGTH()applied to a numeric or date/datetime column, expecting it to return the number of digits or characters in some formatted representation, when the function isn't defined for those types at all.LENGTH()applied to the result of an expression that isn't itself a string — an arithmetic expression, a date subtraction, or a function call returning a non-character type.- A generic reporting/validation routine applying
LENGTH()uniformly across a row's columns without filtering to character-typed columns first.
Solutions / Resolution
- Review the uses of
LENGTHand confirm each applies only to character values, per the official guidance. - Cast a non-character value to a string first, if measuring its formatted length is
genuinely the goal:
SELECT LENGTH(order_id::VARCHAR(10)) FROM orders; - Use a type-appropriate alternative if length wasn't really what was needed — for example,
DAY()/MONTH()/YEAR()to extract components of a date, rather than measuring the length of its string form.
Examples
The disallowed application
SELECT LENGTH(order_id) FROM orders;
-- -575: order_id is INT, not a character type
Casting to a string first
SELECT LENGTH(order_id::VARCHAR(10)) FROM orders;
Diagnostic Checks
- Check the declared type of the column/expression passed to
LENGTH()— anything other thanCHAR/VARCHAR(or a compatible character type) triggers this error.
Related Errors / Related Topics
No closely related error codes are cross-referenced for -575 in this set yet.
LENGTH() only accepts character values — cast a non-character expression to a string first if
its formatted length is genuinely what's needed.