Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: select with Null

Re: select with Null

From: <Marcos.Vera_at_msconsultores.com.pe>
Date: Wed, 22 Nov 2000 13:17:02 -0500
Message-Id: <10688.122745@fatcity.com>


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 Lists

--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: 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). Received on Wed Nov 22 2000 - 12:17:02 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US