ESCAPE with MATCHES

The ESCAPE clause can specify an escape character that is different from the default escape character. The default escape character is set by the DEFAULTESCCHAR configuration parameter or the DEFAULTESCCHAR session environment option.

Use this as you would the default escape character, the backslash, to include a question mark ( ? ), an asterisk ( * ), a caret ( ^ ), or a left ( [ ) or right ( ] ) bracket as a literal character within the quoted string, to prevent them from being interpreted as special characters. If you choose to use z as the escape character, the characters z? in a string stand for a literal question mark ( ? ). Similarly, the characters z* stand for a literal asterisk ( * ). Finally, the characters zz in the string stand for the single character z.

The following example retrieves rows from the customer table in which the value of the company column includes the question mark ( ? ):
SELECT * FROM customer WHERE company MATCHES '*z?*' ESCAPE 'z';