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

Home -> Community -> Usenet -> c.d.o.misc -> Re: How to compare NUMBER's >>>>> How to avoid the error of 'divided by zero'?

Re: How to compare NUMBER's >>>>> How to avoid the error of 'divided by zero'?

From: William Robertson <williamr2019_at_googlemail.com>
Date: Wed, 08 Aug 2007 23:10:48 -0700
Message-ID: <1186639848.466982.232380@b79g2000hse.googlegroups.com>


On Aug 9, 5:54 am, "Jimmy" <lofe..._at_yahoo.com.cn> wrote:
> Sorry, I may not describe the question in the right way because of the
> confusing result.
> Well, now I got to know that is a problem about devided by zero.
>
> As oracle sql will raise an error of attempting to divided by zero.
>
> But I still wonder how this can be even if I use WHERE s2<>0 and
> (s1-s2)/s2>0.5?
> I have to change it to (s1-s2)/decode(s2,0,100,s2)>0.5, which is definitely
> only a cheat
> to the interpreter.
>
> I wonder if there is some way elegant to avoid that?
>
> Version: Oracle9i Enterprise Edition Release 9.2.0.1.0
> OS: WinXP

If you find NULLIF more elegant than DECODE, then use that. Received on Thu Aug 09 2007 - 01:10:48 CDT

Original text of this message

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