Lain Inverse
Member since Oct 21, 2012
- Profile: /members/10369-lain-inverse.htm
- Comments: 2
Recent Blog Comments By Lain Inverse
-
Using NULLIF() To Prevent Divide-By-Zero Errors In SQL
Posted on Jun 10, 2013 at 12:28 PM
@Mohammad, I guess you meant COALESCE() which is mentioned in the article. Yes, it's more widely implemented while Oracle uses NVL instead of ISNULL but each function have own purpose. COALESCE is more complex function and capable to accept any number of parameters while isnull/nvl are tailored to ... read more »
-
Using NULLIF() To Prevent Divide-By-Zero Errors In SQL
Posted on Oct 21, 2012 at 3:29 AM
Addendum: In case when divisor could be NULL it's important to NVL it to ZERO. At least Oracle's implementation of NULLIF doesn't accept NULL value as valid parameter and returns error message about it. So, in complete form it looks like: nullif(nvl(divisor,0),0) NVL will change NULL on 0 and NU... read more »