Informix Error -29040: Cannot translate MATCHES pattern to LIKE pattern.
Cause and resolution
Cannot translate MATCHES pattern to LIKE pattern.
The Gateway does not support and cannot translate one or more characters in the MATCHES condition of your SQL statement. Try to rewrite the statement to use LIKE instead of MATCHES condition syntax or to not include MATCHES wildcard characters such as [ ] and ? or *. Check also that you did not try to include a non-CHAR or VARCHAR column with MATCHES in the WHERE clause.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-29040 fires when the Gateway can't translate a MATCHES condition's pattern into an
equivalent LIKE pattern — per the official guidance, the target DBMS doesn't have a
MATCHES equivalent, so the Gateway must translate to LIKE.
- A
MATCHESpattern using a character the Gateway can't translate, per the official guidance — the direct, only cause. MATCHESapplied to a non-CHAR/VARCHARcolumn, per the official guidance — a further named case.
Solutions / Resolution
- Rewrite the statement using
LIKEinstead ofMATCHES, per the official guidance, or - Avoid
MATCHESwildcard characters ([,],?,*) the Gateway can't translate, per the official guidance. - Confirm
MATCHESis applied only toCHAR/VARCHARcolumns, per the official guidance.
Examples
A MATCHES pattern the Gateway can't translate
SELECT * FROM orders WHERE status MATCHES '[AB]*';
-- -29040: Gateway can't translate this MATCHES pattern to LIKE
Corrected — using LIKE directly
SELECT * FROM orders WHERE status LIKE 'A%' OR status LIKE 'B%';
Diagnostic Checks
- Check the
MATCHESpattern for untranslatable wildcards, and the target column's type.
Related Errors / Related Topics
No closely related error codes are cross-referenced for -29040 in this set yet.
A MATCHES pattern couldn't be translated to LIKE for the target DBMS — rewrite using
LIKE directly, or avoid untranslatable wildcards.