Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: How to eliminate divide by zero error
> 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
![]() |
![]() |