Query not using Index [message #607322] |
Tue, 04 February 2014 22:55 |
|
gurcharan.singh
Messages: 4 Registered: September 2012
|
Junior Member |
|
|
Hi Team,
I have a Table (Table_NM) with two (COL1, COL2) columns and I already created the Index for each column.
My Query is:
SELECT COUNT (*)
FROM Table_NM
WHERE (CASE WHEN '1' = '2' THEN col1 ELSE col2 END) = 'ABC';
Problem statement : Above query not using the index it shown the FULL Table Access in Explain plan.
But if I Modified the query as below , Then it is using the Index.
SELECT COUNT (*)
FROM Table_NM
WHERE (CASE WHEN 1 = 2 THEN col1 ELSE col2 END) = 'ABC';
Why this behaviors I am getting ?
|
|
|
|
|
|
|
|
|
|
|