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: <sybrandb_at_hccnet.nl>
Date: Thu, 09 Aug 2007 07:23:52 +0200
Message-ID: <k19lb354i6krmbs932f5loi1s6eb7atii8@4ax.com>


Comments embedded

On Thu, 9 Aug 2007 12:54:25 +0800, "Jimmy" <lofenee_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?

because condition evaluation is not short circuited
>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?
The most elegant way would probably be to replace the developer who puts his head in the sand and refuses to develop robust applications because the code is not 'elegant'.
The main criterion for code is it should *WORK*
>
>Version: Oracle9i Enterprise Edition Release 9.2.0.1.0
>OS: WinXP
>
>

You are aware Oracle no longer supports you because you didn't upgrade to 9.2.0.8?

-- 
Sybrand Bakker
Senior Oracle DBA
Received on Thu Aug 09 2007 - 00:23:52 CDT

Original text of this message

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