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: Geoff Muldoon <geoff.muldoon_at_trap.gmail.com>
Date: Thu, 9 Aug 2007 15:33:01 +1000
Message-ID: <MPG.212552177db2ebb498999d@news.readfreenews.net>


Jimmy says...
> Sorry, I may not describe the question in the right way because of the
> confusing result.
>
> But I still wonder how this can be even if I use WHERE s2<>0 and
> (s1-s2)/s2>0.5?

select
(case when s2=0 then 'a null result' -- must be first in case statement

      when (s1-s2)/s2>0.5 then 'a big result'
      else 'not a big result' end) div_result
from table_with_s1_and_s2;

GM Received on Thu Aug 09 2007 - 00:33:01 CDT

Original text of this message

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