Title: Dynamically preventing use of index

Hi,
I have a table with two column, each having  non-unique index. The following select is used to fetch records. The variables ‘var1’ and ‘var2’ are provided for execution. Only one of the two variables is provided. The requirement is to use the index on that column only for which the value is provided and avoid use of the other column index. Is this possible in a select stmt in RBO?

Oracle uses both the indexes by default, irrespective of the values provided.

Select col1, col2
from   am49
where col1 = var1
or       col2 = var2;

The above query should use the index on col1 only when var1 is provided and vice versa.

On Oracle 8.1.7 (RBO)

rgds
amar
http://amzone.netfirms.com

Reply via email to