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

Home -> Community -> Usenet -> c.d.o.tools -> Re: How can I treat NULL-Values as Zero

Re: How can I treat NULL-Values as Zero

From: Jonathan Gennick <jonathan_at_gennick.com>
Date: 2000/08/01
Message-ID: <hb9cos8c0vm1qt183bhr8aoattalfb47ib@4ax.com>#1/1

Use Oracle's NVL function. For example:

:new:field:=NVL(:new.f1,0)+NVL(:new.f2,0);

The NVL function returns the second value only if the first value is NULL.

regards,

Jonathan



jonathan_at_gennick.com
http://gennick.com
Brighten the Corner Where You Are

On Mon, 31 Jul 2000 22:19:31 +0200, "Nicolas Bronke" <newsgroup_at_trinity.de> wrote:

>Is it possible to define how Oracle treats Null-Values?
>My problem if I make e.g. a summarize in a trigger like
>
>:new:field:=:new.f1+:new.f2;
>
>The result will be NULL if either F1 or F2 is NULL.
>
>Sometimes I would prefer to receive ZERO. With two fields it is no problem
>for checking null-values but sometimes the formula is more complecate.
>
>Tjanks for any hint.
>
>regards
>Nicolas
>
Received on Tue Aug 01 2000 - 00:00:00 CDT

Original text of this message

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