In Oracle, the escape keyword is used to escape some special characters to the meaning of the original characters. The syntax is "select * from table name where column name like '% character_%' escape '/' "; If "/" is used as the search character, "/" must also be used as the escape character.
The operating environment of this tutorial: Windows 10 system, Oracle 11g version, Dell G3 computer.
Definition: The escape keyword is often used to escape certain special characters, such as wildcard characters: '%', '_' to their original character meanings , the defined escape character is usually '\', but other symbols can also be used.
Example:
Note: If '/' is used as the search character, '/' must be used as the escape character, and the same is true for forward and slash characters.
select * from wan_test where psid like ‘%//%’ escape ‘/‘
1. Use the ESCAPE keyword to define the escape character. When an escape character precedes a wildcard character in a pattern, the wildcard character is interpreted as an ordinary character.
2.ESCAPE ‘escape_character’ allows searching for wildcard characters in a string instead of using them as wildcard characters. escape_character is the character placed before the wildcard to represent this special purpose.
select * from a WHERE name LIKE ‘%/%ab’ ESCAPE ‘/‘
The result is:
name -————- 11%ab 12%ab www.123.com ================================================================================== SQL> select * from test; TEST -—————————- sdd_kk d’d dfsfsa dffa%asfs 12345 1%2345 1%54321 2%54321 %%54321 A&B
Recommended tutorial: "Oracle Video Tutorial"
The above is the detailed content of How to use escape in oracle. For more information, please follow other related articles on the PHP Chinese website!