6.5.5 use escape to define escape characters
When you use the LIKE keyword for a fuzzy query, "%", "_" and "[]" are considered wildcard characters when they appear alone. To query for the existence of a percent sign (%), underscore (_), or square brackets ([]) characters in a column of character data types, you need a way to tell the DBMS that these characters in a like sentence are considered to be actual values, not wildcard characters. The keyword escape allows you to determine an escape character that tells the DBMS that the character immediately following the escape character is considered to be the actual value. As in the following expression:
The escape character "M" is defined using the Escape keyword, telling the DBMS to use the second percentile (%) in the search string "%m%" as the actual value instead of the wildcard character. Of course, the first percentile (%) is still considered a wildcard, so the string that satisfies the query condition is all a string ending in%.
Similarly, the following expression:
Like ' ab&_% ' ESCAPE ' & '
|
At this point, the escape character "&" is defined, and the character in the search string immediately after "&", that is, "_" as the actual character value, not a wildcard character. The expression "%" is still treated as a wildcard character. The query condition for the expression is all strings that start with "Ab_".