Re: HELP! Oracle Error

From: Lawrence V. Rohrer <lrohrer_at_earthlink.net>
Date: 1995/09/29
Message-ID: <44fpa9$fam_at_mars.earthlink.net>#1/1


Jee Myeong Ku <jku> wrote:
>I get an oracle divide by zero error when I type the following SQL command:
>
>select * from sales where cost / quantity > 0.5
>
>The reason is that there is at least one row in the sales table where
>the value of the field quantity is 0.
>
>Does anyone know a way to get around this problem without using views
>or nested queries?
>
>Jee Ku
>

Why won't this work:

select *
  from sales
 where cost / decode(quantity,0,1,quantity ) > .05    and nvl(quantity,0) != 0

There are other tricks avialable...

Lawrence V. Rohrer
1500 Adams #105
Costa Mesa, California 92626
lrohrer_at_earthlink.net
http://www.earthlink.net/~lrohrer/index.html Received on Fri Sep 29 1995 - 00:00:00 CET

Original text of this message