Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: select with Null
Unless we are talking 8i and function based indexes,
that query doesn't use indexes, neither before nor after
the full scan.
-----Original Message-----
From: Natasha Batson [mailto:nbatson_at_neal-and-massy.com]
Sent: Wednesday, November 22, 2000 2:31 PM
To: Multiple recipients of list ORACLE-L
Subject: Re: select with Null
Clarify something for me please:
Nulls are not stored in an index.
So the query :
select d.discount_type
from discount d
where (NVL(d.company_code,'XX') = 'XX')
and (NVL(d.operator_code,'YY') = 'YY')\
will first perform a full table scan to find the nulls and then utilise the index to locate the values?
select d.discount_type
from discount d
where (NVL(d.company_code,'XX') = 'XX')
and (NVL(d.operator_code,'YY') = 'YY')
Raj Gopalan <raj.gopalan_at_netdecisions.co.uk> on 22/11/2000 12:35:24 PM
Please respond to ORACLE-L_at_fatcity.com
To: Multiple recipients of list ORACLE-L <ORACLE-L_at_fatcity.com> cc: (bcc: Marcos Vera/M&S Consultores/51)
Subject: select with Null
Hello list,
I have a query
select d.discount_type
from discount d
where (d.company_code = 'XX' or
d.company_code is null) and (d.operator_code = 'YY' or d.operator_code is null)
Apparently, oracle is not using the index since I am using IS NULL. But the functional requirement is such that the query need to consider records even if company_code, Operator_code ,... is null.
Any thoughts on how do I modify this query so that the index is being used.
TIA
Raj
--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author: Raj Gopalan
INET: raj.gopalan_at_netdecisions.co.uk
Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051 San Diego, California -- Public Internet access / Mailing Liststo: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author:
INET: Marcos.Vera_at_msconsultores.com.pe
Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051 San Diego, California -- Public Internet access / Mailing Liststo: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author: Natasha Batson
INET: nbatson_at_neal-and-massy.com
Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051 San Diego, California -- Public Internet access / Mailing Liststo: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may Received on Mon Nov 27 2000 - 09:16:53 CST
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
![]() |
![]() |