How do I escape multiple characters in an sql like string?
You misunderstood the meaning of escape
: it lets you define a character such that when you put it in front of another character, that other character is interpreted literally, not as a meta-character. You need only one such escape character: you can use it to escape any meta-character.
In the example below I used '#'
as my escape character:
select * from tableName where columnName like 'C#%U#_C' escape '#'
This tries to match C%U_C
strings where both '%'
and '_'
are interpreted literally, not as a sequence of any characters or any single character.
Escape Characters
Example for a single character '' :
'high\-voltage'
Example for a string or multiple characters '{string}' :
'{high-voltage}'
- ' - ' is a non alnum character
Reference : https://docs.oracle.com/cd/B10501_01/text.920/a96518/cqspcl.htm