Informix Error -946: Source string for UPPER, LOWER, and INITCAP must be of string type.
Cause and resolution
Source string for UPPER, LOWER, and INITCAP must be of string type.
The source string passed as input to a case conversion function must have a character data type.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-946 fires when UPPER, LOWER, or INITCAP is called with an argument that isn't a character
type — per the official guidance, the input must be a string type.
- A non-string value passed to
UPPER/LOWER/INITCAP, 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
- Confirm the source argument is character-typed, per the official guidance.
- Cast explicitly if a conversion is genuinely needed:
SELECT UPPER(order_id::VARCHAR(10)) FROM orders;
Examples
The disallowed non-string argument
SELECT UPPER(order_id) FROM orders;
-- -946: order_id is INT, not a string type
Corrected — explicit cast
SELECT UPPER(order_id::VARCHAR(10)) FROM orders;
Diagnostic Checks
- Check the declared type of the argument passed to
UPPER/LOWER/INITCAPagainst the string-type requirement.
Related Errors / Related Topics
- -941 — "String processing error while evaluating function (function_name)." A related case-conversion-function error, about an invalid character within an otherwise-valid string argument, rather than a non-string argument type entirely.
- -880 — "Trim character and trim source must be of string data type." The same string-type
requirement, for
TRIM's arguments rather thanUPPER/LOWER/INITCAP.
The same string-type requirement as -880, here for UPPER/LOWER/INITCAP — cast explicitly
if the source is a non-string type.