In oracle, like condition is used with select, insert, update, and delete in where clause using wildcard. It allows pattern matching.
Syntax
expression LIKE pattern [ESCAPE 'escape_character' ]
Parameters
expression: name of column.
pattern: patter to be matched in expression. Pattern can be in one of the following:-
Wildcard | Explanation |
---|---|
% | Used for matching string |
_ | Used for matching single character |
Table 1:
Table 2:
Example 1
Query: select * from table1 where name like ‘s%’
Example 2
Query: select * from table1 where name like ’22___’
Example 3
Query: select * from table1 where name NOT like ‘s%’
Leave a Reply