Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Multiple conditions in Like operator

user549774Oct 26 2015 — edited Oct 26 2015

In the employee table i have one column called name

ID       NAME

1       aa bb cc

2       aa bb cc dd

3       dd bb cc aa ee ff

I am using this below query

QUERY

=====

select * from employee where name like '%aa%' or name like '%bb% or name like '%cc%'.....

But in the above table the values in the name column is not fixed.it is growing like aa bb cc

Next row NAME Column Contains aa bb cc dd.....

Currently i am using the above query in one of the procedure.Name is the INPUT parameter.I am taking

each value in the NAME column and put in the multiple like operator using OR condition.

select * from employee where name like '%aa%' or name like '%bb% or name like '%cc%'.....

so is there any method to simplify the above query instead of multiple OR Conditions...

for example-> select * from employee where name like('%aa%','%bb%','%cc%')

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 23 2015
Added on Oct 26 2015
4 comments
9,943 views