divisor is equal to zero error [message #628389] |
Mon, 24 November 2014 13:22 |
|
kkeebler
Messages: 1 Registered: November 2014 Location: New York
|
Junior Member |
|
|
I'm relative new to programming in Oracle SQL and I cannot seem to figure out how to deal with the "divisor is equal to zero" error. Here is a sample of my code with generic table and column names. Can anyone explain why my case statement does not solve the error?
SELECT table1.column1,
table1.column2,
table1.column3,
table1.column4,
SUM(CASE
WHEN ( 1 - table1.age4 ) <= 1 THEN 0
WHEN ( 1 - table1.age4 ) > 1 THEN ( ( table2.age5 ) * ( 1 /
( 1 - table1.age4 ) ) )
ELSE 0
END) AS COLUMN5
FROM table1
inner join table2
ON table2.column1 = table1.column1
GROUP BY table1.column1,
table1.column2,
table1.column3,
table1.column4
ORDER BY table1.column1,
table1.column2,
table1.column3,
table1.column4;
*BlackSwan formatted SQL. Please do so yourself in the future.
[Updated on: Mon, 24 November 2014 13:25] by Moderator Report message to a moderator
|
|
|
|
|