Re: HELP! Oracle Error
Date: 1995/10/11
Message-ID: <45g8ue$745_at_tpd.dsccc.com>#1/1
Maybe try:
SELECT * FROM sales
WHERE cost/DECODE(quantity,0,cost*-1,quantity) > 0.5;
Jessica
Joyce Rowe (J.E.Rowe_at_staffs.ac.uk) wrote:
: 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
: >
: How about trying:
: select * from sales where cost > 0.5 * quantity
: although this would select any records where quantity is zero, so you
: might also want:
: and quantity != 0; or
: quantity is not null if the column is empty
: Joyce
Received on Wed Oct 11 1995 - 00:00:00 CET