Monday, November 16, 2009

Using Escape character in Oracle

In Oracle the '_' character is used to match exactly one character, wherease '%' is used to match zero or more occurrences of any characters. For example if we need to search a string in Oracle with '_' prsence in the column, then in such cases normal LIKE operator will not work. We need to escape the character '_'.

Here is the syntax for escaping the character in Oracle

SELECT name FROM emp WHERE id LIKE '%/_%' ESCAPE '/';

1 comment: