Oracle 字元匹配
阿新 • • 發佈:2018-12-24
百分號 0個或多個字元
下劃線 匹配單個任意字元
ESCAPE Clause Example
You can include the actual characters "%" or "_" in the pattern by using the ESCAPE
clause, which identifies the escape character. If the escape character appears in the pattern before the character "%" or "_" then Oracle interprets this character literally in the pattern, rather than as a special pattern matching character.
To search for employees with the pattern 'A_B' in their name:
SELECT last_nameFROM employees
WHERE last_name LIKE'%A/_B%'ESCAPE'/';
The ESCAPE
clause identifies the backslash (/) as the escape character. In the pattern, the escape character precedes the underscore (_). This causes Oracle to interpret the underscore literally, rather than as a special pattern matching character.