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!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

tunning the sql query with or condition

SandeepwMar 31 2015 — edited Apr 1 2015

Hi I am little new for the oracle sql queries. I have a table having the owners information of a particular product. There are as many 6 owners for a production. The table structure is like:

productproduct idowner1owner2owner3owner4owner5owner6producttype
A1ab123ab124ab125bn657ht567kj768electronic

I want to pass the ownerid and to see the list of the product where he is owner.

I am using the below query:

select count(1) as HAVEACCESS from catalogwhere (lower(OWNER1) = 'owner' or lower(OWNER2) = 'owner'

or lower(OWNER3) = 'owner' or lower(OWNER4) = 'owner' or lower(OWNER5) = 'owner'  or lower(OWNER6) = 'owner' and producttype = 'electronic'

As there are 5 OR condition in the sql query which may impact the performance. Can some one please suggest the better query.

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 29 2015
Added on Mar 31 2015
10 comments
1,727 views