Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: How to compare NUMBER's >>>>> How to avoid the error of 'divided by zero'?
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