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:


Oracle中like查询下划线等特殊字符的处理SELECT last_name
Oracle中like查询下划线等特殊字符的处理    
FROM employees
Oracle中like查询下划线等特殊字符的处理    
WHERE last_name LIKE '%A\_B%' ESCAPE '\';
Oracle中like查询下划线等特殊字符的处理

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.

相关文章:

  • 2022-01-30
  • 2022-12-23
  • 2022-12-23
  • 2021-10-18
  • 2021-06-25
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-05-16
  • 2021-11-08
  • 2022-12-23
  • 2022-12-23
  • 2021-11-18
  • 2022-02-03
相关资源
相似解决方案