Re: Divide By Zero Error
Posted in 1995
>
> Hi All
>
> Does anyone know how to prevent a 'Divide By Zero Error' when executing a
> SELECT. I'm dividing 2 columns in a computed field. There are occasions
> when the divisor WILL be zero. When this condition occurs, instead of the
> 'Divide By Zero Error' occuring I want the result to be zero. I don't
> want to filter the column containing zeros.
union two selects:
SELECT stuff...... col1/col2
WHERE .....
AND col2 != 0
UNION
SELECT stuff...... 0
WHERE .....
AND col2 != 0
cheers
j.
_____________________________________________________________________________
Jack Parker - Hewlett Packard, BSMC Boise, Idaho, USA
jparker@hpbs3645.boi.hp.com
_____________________________________________________________________________
Discover America, get lost on a rally.
_____________________________________________________________________________
Any opinions expressed herein are my own and not those of my employers.
_____________________________________________________________________________