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!

SQL rewrite or HINTS

alinuxJun 29 2012 — edited Jul 2 2012
Hi guys,

Please help me with this because I have tried some things and they did not work.
SELECT *
FROM   cont_cust
WHERE  ACCOUNT_NO = 12 OR
       ACCOUNT_NO IN
       (SELECT ACCOUT_NO FROM cont_cust WHERE name like 'GUGU%')
The table_cust table has indexes on account_no and name. I was expecting this sql to find the accounts that have the name like 'GUGU' and concatenate the result with account equal to 12.
But it executes with a FILTER on a FULL TABLE scan.
My sql it is a bit more complex and I understand that this specific SQL can be rewritten to go on TABLE cast only once.

Do you have any idea? any SQL HINT?

Thanks
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 30 2012
Added on Jun 29 2012
11 comments
231 views