SQL tutorial | Interview questions | Oracle
Would you like to react to this message? Create an account in a few clicks or log in to continue.

How To Use Regular Expression in Pattern Match Conditions?

Go down

How To Use Regular Expression in Pattern Match Conditions? Empty How To Use Regular Expression in Pattern Match Conditions?

Post by Micheal Sat Jan 16, 2010 9:24 pm

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 ('FYICenter.com', '.*fyi.*','i')
THEN 'TRUE' ELSE 'FALSE' END FROM DUAL;
TRUE
SELECT CASE WHEN REGEXP_LIKE ('FYICenter.com', '.*com$','i')
THEN 'TRUE' ELSE 'FALSE' END FROM DUAL;
TRUE
SELECT CASE WHEN REGEXP_LIKE ('FYICenter.com', '^F.*','i')
THEN 'TRUE' ELSE 'FALSE' END FROM DUAL;
TRUE

Micheal
Admin

Posts : 243
Join date : 2010-01-10

http://sql-tutorial.co.cc

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum