Informix Error -1203: Values used in a MATCH must both be type CHARACTER.
Cause and resolution
Values used in a MATCH must both be type CHARACTER.
The MATCHES relationship applies only to character data; both of its operands must be CHAR or VARCHAR columns or variables, or literal character strings. If you need to apply a regular-expression pattern match to a numeric value, you can do so in 4GL. Assign the numeric value to a CHAR variable, and test that variable.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-1203 fires when the MATCHES operator is used with an operand that isn't CHAR/VARCHAR —
per the official guidance, both operands must be character types.
- A non-character operand (numeric, date, etc.) passed to
MATCHES, per the official guidance — the direct, only cause.
Solutions / Resolution
- Convert the non-character value to
CHARbefore testing it withMATCHES, per the official guidance, if pattern matching against it is genuinely needed.
Examples
A numeric value used with MATCHES
SELECT * FROM orders WHERE order_id MATCHES '4*';
-- -1203: order_id is INTEGER, not CHARACTER
Corrected — convert first
SELECT * FROM orders WHERE order_id::CHAR(10) MATCHES '4*';
Diagnostic Checks
- Check the data type of both operands in the
MATCHESexpression, and convert any non-character operand explicitly.
Related Errors / Related Topics
No closely related error codes are cross-referenced for -1203 in this set yet.
MATCHES requires both operands to be CHAR/VARCHAR — convert a non-character value first.