Informix Error -880: Trim character and trim source must be of string data type.
Cause and resolution
Trim character and trim source must be of string data type.
You used a TRIM function where the TRIM character value expression and the source character value expression were conflicting data types. The character and source value expressions must be the string data type. Check the syntax of the TRIM function, and check that the character and source values contain string data type values.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-880 fires when TRIM's character-to-trim argument or its source (the value being trimmed)
isn't a string type — per the official guidance, both must be string types.
- A non-string value passed as the trim character or the source, per the official guidance — a numeric or date value where a character string is required.
- A column/expression of the wrong type referenced by mistake, where a similarly-named string column was intended instead.
Solutions / Resolution
- Check the syntax of the
TRIMfunction call, per the official guidance. - Check that both the character and source values are string-typed, per the official
guidance — cast explicitly if a conversion is genuinely needed:
TRIM(BOTH ' ' FROM order_id::VARCHAR(10));
Examples
The disallowed non-string source
SELECT TRIM(BOTH ' ' FROM order_id) FROM orders;
-- -880: order_id is INT, not a string type
Corrected — explicit cast
SELECT TRIM(BOTH ' ' FROM order_id::VARCHAR(10)) FROM orders;
Diagnostic Checks
- Check the declared type of both the trim character and the source value against
TRIM's string-type requirement.
Related Errors / Related Topics
- -879 — "Trim character must be null or have a length of 1." A related
TRIMrestriction, about the character argument's length rather than its data type.
Both TRIM arguments must be string types — cast explicitly if either is a non-string value.