Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> nvl not using index
what surprise me more is that if i use where
clause as ( p_loginid is null or p_loginid=loginid ), it does not use
index as well .
Why ??
----- Original Message -----
From: <A
title=bigplanet34_at_hotmail.com href="mailto:bigplanet34_at_hotmail.com">Big
Planet
To: <A title=ORACLE-L_at_fatcity.com
href="mailto:ORACLE-L_at_fatcity.com">Multiple recipients of list ORACLE-L
Sent: Monday, September 10, 2001 2:17 PM Subject: nvl not using index
Hi All ,
I am writing this proc does a search in
database based on these in parameters and returns a ref cursor . Now
one more of these in parameters can be null and my query should return data
neglecting null parameters . So I use nvl in the query as shown below
.
Now my problem is , the query doesnt use index
available on table since i m using a function .
Is there any way I can rewrite this query so that
it meets my requirements and use the index . I have other option is to create
a dynamic sql based on in parameters .
TIA for any help .
-BigP
PROCEDURE get_alertlog <FONT
color=#0000f0 size=2>( p_loginid varchar2
<FONT color=#0000f0
size=2>,
<FONT
color=#0000f0>p_startdate date<FONT
color=#0000f0>out <FONT color=#ff0000>number,<FONT color=#000000>
color=#0000f0>out <FONT color=#ff0000>varchar2,<FONT color=#000000>
color=#0000f0>, logtype <FONT color=#0000f0>, logaction <FONT color=#0000f0>, logdate <FONT color=#0000f0>, memberpin <FONT color=#0000f0>
color=#0000f0>(p_startdate<FONT color=#0000f0>,to_date<FONT color=#0000f0>('1-jan-1900'<FONT color=#0000f0>,'dd-mon-rrrr'<FONT color=#0000f0>) <FONT color=#0000f0>)
color=#0000f0>(p_enddate <FONT color=#0000f0>, <FONT color=#0000f0>sysdate <FONT color=#0000f0>) <FONT color=#0000f0>;
![]() |
![]() |