Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: HELP- How to ignore Divide by Zero error in database

Re: HELP- How to ignore Divide by Zero error in database

From: DA Morgan <damorgan_at_x.washington.edu>
Date: Sat, 06 Nov 2004 05:05:26 -0800
Message-ID: <1099746258.868378@yasure>


Mario King wrote:

> Hi,
>
> User's SQL script generated "ORA-01476: divisor is equal to zero".
> How to make database to ignore this error and script to continue?
>
> Thanks in advance.
>
> MK

In addition to Davide and Bricklen's suggestions:

DECLARE
  z NUMBER := 0;
  x NUMBER;
BEGIN
   x := 3 / z;
EXCEPTION
    WHEN ZERO_DIVIDE THEN
       NULL;
END dbz_exception;
/

also works.

-- 
Daniel A. Morgan
University of Washington
damorgan_at_x.washington.edu
(replace 'x' with 'u' to respond)
Received on Sat Nov 06 2004 - 07:05:26 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US