Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 Other Topics
 Conditional Statements

Author  Topic 

briggsMJ
Starting Member

2 Posts

Posted - 2011-11-08 : 11:31:38
Hello all,

First time post so forgive me if I screw it up.

Im trying to divide column LA5_RES_TOTAL_PARCEL by RES_EXEMP_PERCT, however, I keep getting the error message "divisor is zero." I've played around with different conditional statements but haven't had much luck. Here's the query I'm running, pretty basic.

SELECT
DLSGATEWAY.JURISDICTION.JURISDICTIONCODE,
DLSGATEWAY.JURISDICTION.NAME,
DLSGATEWAY.LA5_OPTIONS.LA5_RES_TOT_PARCEL,
DLSGATEWAY.LA5_OPTIONS.RES_EXEMP_PERCT,
DLSGATEWAY.LA5_OPTIONS.NUM_RES_PARCEL_EXEMP,
DLSGATEWAY.LA5_OPTIONS.TOT_COMM_VAL_ELGBL,
DLSGATEWAY.LA5_OPTIONS.COMM_EXEMP_PERCT
FROM
DLSGATEWAY.JURISDICTION,
DLSGATEWAY.LA5_OPTIONS
WHERE
DLSGATEWAY.JURISDICTION.JURISDICTIONCODE=DLSGATEWAY.LA5_OPTIONS.JUR_CODE
AND DLSGATEWAY.JURISDICTION.JURISDICTIONCODE <= 351
AND DLSGATEWAY.LA5_OPTIONS.FISCAL_YEAR = 2011

Any help is much appreciated!

edit: moved to proper forum

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2011-11-08 : 11:37:15
"divisor is zero."? Is it ORACLE? This is a MS SQL Server forum.
In MS SQL Server I would do:
LA5_RES_TOTAL_PARCEL / nullif(RES_EXEMP_PERCT,0)


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-11-08 : 12:31:13
i think NULLIF is in Oracle also

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

briggsMJ
Starting Member

2 Posts

Posted - 2011-11-08 : 14:07:46
Im using SQL Navigator 6.5 Am I in the wrong forum?? Dammit. Anywho, I used a DECODE clause and it worked. Is that in Oracle?
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-11-09 : 01:21:55
its in oracle

Also SQL Navigator 6.5 is client tool which can be used to connect to Oracle

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -