Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Divide By zero error
On Mon, 14 Feb 2000 13:18:23 GMT, Parvinder Singh <parora_at_questone.com> wrote:
>Hi all
>
> Can i somehow get rid of "divide by zero error" ?
> ERROR:
> ORA-01476: divisor is equal to zero
> All i want is wherever the divisor's value comes to 0 it should give
>the result of the division as 0
>Can i somehow achieve this ?????
Look at using decode()...
select decode( b, 0, 0, a/b ) from my_table;
hope this helps.
chris.
>
>regards
>~Parvinder
>
>
--
Christopher Beck
Oracle Corporation
clbeck_at_us.oracle.com
Reston, VA.