The DB2 like predicate query statement supports the use of percent sign (%), underscore (_), does not support square brackets ([]) (note: It treats square brackets as actual values rather than wildcards), and when we need to query for the percent sign (%), underscore (_) as the actual value in the like query condition, You need to use escape characters to tell DB2 to treat them as actual values rather than as escape characters. However, the escape character is not defined in DB2 (backslash \ is not an escape character in DB2), so it needs to be defined using the Escape keyword like '%!% ' escape '! '.
It is worth noting that the processing of single quotes is a bit different from the processing of a percent sign (%), an underscore (_), which can only be escaped using single quotes for single quotes, for example: Like ' A% ', which matches the string "a" that begins with the string percent sign (%) Escape: SELECT * From table where col1 like '%/%% ' escape '/' this statement means to find a record that contains a percent percent (%) character in col1. Where escape defines the escape character "/" underscore (_) Escape: SELECT * FROM table where col1 like '%!_% ' escape '! ' The meaning of this statement is to find a record that contains the underscore (_) character in the col1. Where escape defines the escape character "!" escape of single quotation marks: SELECT * from table where col1 like '% '% ' This statement means: Find records containing single quote characters in col1
MySQL learn three about escaping