Informix Error -543
Cause and resolution
ESCAPE character must be only one byte.
In the WHERE clause, a subclause ESCAPE char contains more than one character as char. Review the punctuation of the clause, and revise it so that it specifies just one byte character.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-543 fires when a LIKE ... ESCAPE 'char' clause's escape character specification contains more
than a single byte.
- A multi-character string literal given as the escape character — for example,
ESCAPE '\\'versus an accidentalESCAPE '\\\\'where quoting doubled the backslash into two characters. - A multi-byte character used as the escape character on a database using a multi-byte code set, where a single logical character occupies more than one byte.
- A copy-paste or string-building bug in generated SQL that concatenated more than one
character into the
ESCAPEclause's literal.
Solutions / Resolution
- Review the punctuation of the
ESCAPEclause, per the official guidance, and revise it to specify exactly one byte. - Pick a single-byte character not otherwise meaningful in the pattern, commonly
\or!, as the escape character. - On a multi-byte code set, choose an escape character from the single-byte (ASCII) range, since the limit is one byte, not one logical character.
Examples
Too many characters
SELECT * FROM products WHERE code LIKE '50\%%' ESCAPE '\\';
-- -543: '\\' as a string literal is two characters/bytes
Corrected
SELECT * FROM products WHERE code LIKE '50\%%' ESCAPE '\';
Diagnostic Checks
- Check the byte length of the literal passed to
ESCAPE— a single quoted character should be exactly one byte; anything longer needs revising.
Related Errors / Related Topics
No closely related error codes are cross-referenced for -543 in this set yet.
A one-byte-only limit on the LIKE...ESCAPE character — check the literal's actual byte length, not just how many characters it looks like in the source.