Answers

Question and Answer:

  Home  Oracle Database

⟩ How To Use LIKE Conditions in Oracle?

LIKE condition is also called pattern patch. There 3 main rules on using LIKE condition:

* '_' is used in the pattern to match any one character.

* '%' is used in the pattern to match any zero or more characters.

* ESCAPE clause is used to provide the escape character in the pattern.

The following script provides you some good pattern matching examples:

SELECT CASE WHEN 'rendc.org' LIKE '%Center%'

THEN 'TRUE' ELSE 'FALSE' END FROM DUAL;

TRUE

SELECT CASE WHEN 'rendc.org' LIKE '%CENTER%'

THEN 'TRUE' ELSE 'FALSE' END FROM DUAL;

-- Case sensitive by default

FALSE

SELECT CASE WHEN 'rendc.org' LIKE '%Center_com'

THEN 'TRUE' ELSE 'FALSE' END FROM DUAL;

TRUE

SELECT CASE WHEN '100% correct' LIKE '100% %' ESCAPE ''

THEN 'TRUE' ELSE 'FALSE' END FROM DUAL;

TRUE

 146 views

More Questions for you: