escape就是这样的。 对于'AAB' ESCAPE 'A' 它会escape第一个'A' 而对于'AAAB' ESCAPE 'A' ,它会直接匹配'AAAB',就相当于没有escape 你仔细看看escape的用法就明白了。 Let P1, P2, ..., Pn be these subpatterns. The like condition is true if there is a way to partition the search value into substrings S1, S2, ..., Sn so that for all i between 1 and n: *If Pi is _, then Si is a single character. *If Pi is %, then Si is any string. *If Pi is two characters beginning with an escape character, then Si is the second character of Pi. * Otherwise, Pi = Si.
用于表示表达式中的另一个字符表示字面意义而不是运算符的字符。例如,在 SQL 中,字符 "%" 用作通配符,以表示 "该位置中任意个数的字符"。但是,如果希望搜索 "10%"(百分之十)之类的字符串,则不能只指定 "10%" 作为搜索字符串,因为 "%" 将解释为 "除 10 以外还有任意个数的字符"。通过指定转义符,可以标记 "%" 特指百分号的实例。例如,如果指定转义符 "#",则可以指定搜索字符串 "10#%" 表示 "百分之十"。
对于'AAB' ESCAPE 'A' 它会escape第一个'A'
而对于'AAAB' ESCAPE 'A' ,它会直接匹配'AAAB',就相当于没有escape
你仔细看看escape的用法就明白了。
Let P1, P2, ..., Pn be these subpatterns. The like condition is true if there is a way to
partition the search value into substrings S1, S2, ..., Sn so that for all i between 1 and n:
*If Pi is _, then Si is a single character.
*If Pi is %, then Si is any string.
*If Pi is two characters beginning with an escape character, then Si is the second
character of Pi.
* Otherwise, Pi = Si.