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: Consistent Null Handling

RE: Consistent Null Handling

From: Steve Rospo <srospo_at_watchmark.com>
Date: Fri, 3 Sep 2004 08:59:29 -0700 (PDT)
Message-ID: <Pine.GSO.4.44.0409030850390.12969-100000@sapphire.wa.watchmark.com>

Take a table with all nulls in x but at least one row:

sum(x) => null
sum(nvl(x,0)) => 0
nvl(sum(x),0) => 0

Take a table with no rows:

sum(x) => null
sum(nvl(x,0)) => null
nvl(sum(x),0) => 0

S-

On Fri, 3 Sep 2004, Wolfgang Breitling wrote:

> I don't get that. Under what circumstances will sum(x) and sum(nvl(x,0)) give
> different results? I can see it for avg, but for sum?
>
> Quoting Lex de Haan <lex.de.haan_at_naturaljoin.nl>:
>
> > Note however that the following three Oracle expressions are (and always
> > have been) *different*
> > that is, they give *different* results under certain conditions:
> >
> > - sum(x)
> > - sum(nvl(x,0))
>
>

--
To unsubscribe - mailto:oracle-l-request_at_freelists.org&subject=unsubscribe 
To search the archives - http://www.freelists.org/archives/oracle-l/
Received on Fri Sep 03 2004 - 10:56:18 CDT

Original text of this message

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