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

Home -> Community -> Usenet -> c.d.o.server -> Re: How to eliminate divide by zero error

Re: How to eliminate divide by zero error

From: D <email0203_at_comcast.net>
Date: 9 Mar 2007 07:05:28 -0800
Message-ID: <1173452727.800649.145830@8g2000cwh.googlegroups.com>

> The DECODE function is useful here. Assume you are going to divide x by
> y. Then the following DECODE will show that result unless y=0, and then
> it will show something else:
>
> DECODE(y,0,'N/A',x/y)
>
> You'll have to decide what the output will be if y is zero.
>
> Either that, or consider eliminating those rows where y=0 by including:
>
> WHERE y<>0
>
> in your SQL statement.
>
> HTH,
> Brian
>
> --
> ===================================================================
>
> Brian Peasland
> d...@nospam.peasland.nethttp://www.peasland.net
>
> Remove the "nospam." from the email address to email me.
>
> "I can give it to you cheap, quick, and good.
> Now pick two out of the three" - Unknown
>
> --
> Posted via a free Usenet account fromhttp://www.teranews.com

Thanks brian, I will try your suggestion. Received on Fri Mar 09 2007 - 09:05:28 CST

Original text of this message

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