Re: help with replacing OR in query

From: D.Y. <dyou98_at_aol.com>
Date: 13 Aug 2002 10:11:31 -0700
Message-ID: <f369a0eb.0208130911.2c1c8215_at_posting.google.com>


If you think index scans will be faster than a full table scan, you need to have two indexes, one on each of the columns you reference in the where clause. Oracle will first retrieve records which meet the col2 condition then retrieve the ones which meet the col3 condition, and concatenate the two result sets. If Oracle refuses to do that you can use the USE_CONCAT hint to force it.

erick_papadakis_at_yahoo.com (Erick Papadakis) wrote in message news:<737aefee.0208121626.578cf5b6_at_posting.google.com>...
> p.s., if you reply, kindly CC me as well.
>
> hi, i have the following SQL query
>
> select col1 from table1
> where
> col2 = 'xxx' or col3 = 'xxx'
>
> how can i get rid of this OR? due to my table design and the logic
> involved, i have to check both these 2 columns (in a search function). i
> cannot concaneate them to make a third column because i need to check for
> exact match but for both the columns.
>
> so what can i do to replace the OR, because the OR makes the query skip any index.
>
> thanks in advance for any insight/ideas!
>
> .ep
Received on Tue Aug 13 2002 - 19:11:31 CEST

Original text of this message