Basic Oracle Concepts and Programming Question:
Download Job Interview Questions and Answers PDF
How To Use Regular Expression in Pattern Match Conditions in Oracle?
Answer:
If you have a pattern that is too complex for LIKE to handle, you can use the regular expression pattern patch function: REGEXP_LIKE().
The following script provides you some good examples:
SELECT CASE WHEN REGEXP_LIKE ('globalguideline.com', '.*ggl.*',
'i') THEN 'TRUE' ELSE 'FALSE' END FROM DUAL;
TRUE
SELECT CASE WHEN REGEXP_LIKE ('globalguideline.com', '.*com$',
'i') THEN 'TRUE' ELSE 'FALSE' END FROM DUAL;
TRUE
SELECT CASE WHEN REGEXP_LIKE ('globalguideline.com', '^F.*','i')
THEN 'TRUE' ELSE 'FALSE' END FROM DUAL;
TRUE
The following script provides you some good examples:
SELECT CASE WHEN REGEXP_LIKE ('globalguideline.com', '.*ggl.*',
'i') THEN 'TRUE' ELSE 'FALSE' END FROM DUAL;
TRUE
SELECT CASE WHEN REGEXP_LIKE ('globalguideline.com', '.*com$',
'i') THEN 'TRUE' ELSE 'FALSE' END FROM DUAL;
TRUE
SELECT CASE WHEN REGEXP_LIKE ('globalguideline.com', '^F.*','i')
THEN 'TRUE' ELSE 'FALSE' END FROM DUAL;
TRUE
Download Oracle Database Interview Questions And Answers
PDF
Previous Question | Next Question |
How To Use LIKE Conditions in Oracle? | What Are DDL Statements in Oracle? |