Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Re: NULL values in arithmetic
"Matt Pryor" <matt_at_ddm-net.com> wrote in message
news:965294019.687690_at_lnd-hst-1.atlas.net.uk...
> Great, thanks I'll give that a try.
>
> Still don't understand the logic behind "nothing plus something = nothing"
> though!
>
Because null is 'nothing', so trying to add nothing to anything is simply meaningless. It's like trying to add three apples to 2 oranges -you want the system to say you've got 5 appleges, but the best Oracle can do is say you've got some fruit!
It has always been thus. 5 divided by zero is infinity (which is bad enough), but 5 divided by nothing at all is, what? I think if you hunt around, you'll find most programs work this way.
Regards
HJR
>
>
>
> Klaus Zeuch <KZeuch_at_nospamhotmail.com> wrote in message
> news:8m9skk$oa4$18$1_at_news.t-online.com...
> > Hi,
> >
> > that's normal - nothing plus anything is nothing...
> >
> > "Workaround": use the nvl-function to replace occurrences of NULL with
0,
> > e.g.:
> > select (15+nvl(NULL,0)+8+4) from emp;
> >
> > Klaus
> >
> > "Matt Pryor" <matt_at_ddm-net.com> schrieb im Newsbeitrag
> > news:965243472.345182_at_lnd-hst-1.atlas.net.uk...
> > > Hi there,
> > >
> > > I'd expect the following query:
> > >
> > > select (15+NULL+8+4) from emp;
> > >
> > > to ignore the NULL and return the sum of 15,8 and 4. Instead it
returns
> > > NULL.
> > >
> > > Is this normal? Why is it? Is there a workaround?
> > >
> > > Thanks in advance for any help,
> > >
> > > Matt
> > >
> > >
> >
> >
>
>
Received on Sun Aug 06 2000 - 00:00:00 CDT
![]() |
![]() |