Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB SQL » View Thread |
Messages 1 to 4 of 4 total |
Division by zero |
Sun, Jul 12 2020 8:43 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | I'm playing with removing a percentage field and I wanted to see what happened if the divisor was null. I tried
select _ID, 0 / 0, COALESCE(_VAT,0) / COALESCE(_Value,0), _VAT / _Value, _Value, _VAT from analysis in EDBManager. The three calculations all show NULL in the grid when the divisor is 0. I don't know why but division by zero returning NULL rather than bombing out seems wrong. Just wondering what other's opinions are. Roy Lambert |
Sun, Jul 12 2020 2:23 PM | Permanent Link |
Raul Team Elevate | On 7/12/2020 8:43 AM, Roy Lambert wrote:
> I don't know why but division by zero returning NULL rather than bombing out seems wrong. > > Just wondering what other's opinions are. NULL would be my expectation - being equivalent of "undefined" etc Most of the time we'd have it more indirectly - some computed value(s) ends up being divided by zero due to a column being 0. Some DMBS have this as a configurable option even so could be enhancement request for EDB as well if you want to to throw an exception Raul |
Mon, Jul 13 2020 2:27 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Raul
>Some DMBS have this as a configurable option even so could be >enhancement request for EDB as well if you want to to throw an exception I'm not really bothered now I know what its doing, just wondered what others thought. I was just surprised that it was silently handled rather than throwing an error. Googling I found a number of hits on how to use NULLIF to "get round" the error. Since I value my sanity I decided not to try and find out what the standard says Roy |
Wed, Jul 29 2020 10:04 AM | Permanent Link |
Fernando Dias Team Elevate | Roy,
<<Since I value my sanity I decided not to try and find out what the standard says > It says "(...) an exception condition is raised: data exception — division by zero" -- Fernando Dias [Team Elevate] |
This web page was last updated on Sunday, May 19, 2024 at 08:46 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |