Informix Error -1278: Invalid escape sequence.
Cause and resolution
Invalid escape sequence.
Check the pattern-matching string that the LIKE or MATCHES clause of the statement specifies. In an ANSI database, the only valid characters that can be escaped are: %, _, and the escape character for the LIKE clause, and *, ?, [, ], and the escape character for the MATCHES clause.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-1278 fires when an invalid escape sequence appears in a LIKE/MATCHES clause on an ANSI
database — per the official guidance, only specific characters can be escaped: %, _, and the
escape character itself for LIKE; *, ?, [, ], and the escape character itself for
MATCHES.
- A
LIKEclause escaping a character other than%,_, or the escape character itself, per the official guidance — the direct, common cause. - A
MATCHESclause escaping a character other than*,?,[,], or the escape character itself, per the official guidance — the other direct, common cause.
Solutions / Resolution
- Review the pattern-matching string to ensure only valid characters are being escaped, per
the official guidance — matching the clause type (
LIKEvs.MATCHES) to its own specific escapable-character set.
Examples
An invalid LIKE escape
SELECT * FROM orders WHERE status LIKE '50\%' ESCAPE '\';
-- valid: % is escapable in LIKE
SELECT * FROM orders WHERE status LIKE 'a\b' ESCAPE '\';
-- -1278: 'b' is not an escapable character in LIKE
Diagnostic Checks
- Check every escaped character in the
LIKE/MATCHESpattern against that clause type's specific set of valid escapable characters.
Related Errors / Related Topics
- -1279 — "Value exceeds string column length." A related ANSI-database error, about column length rather than pattern-matching escape sequences.
An escape sequence used a character not valid for that clause type (LIKE vs. MATCHES) — check
the pattern against the correct escapable-character set.