Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Handling division equal to zero exception

2674830May 16 2014 — edited May 16 2014

Hi All,

I am new to this forum

I created a trigger, but it's not working.

DECLARE

  v_width INTEGER;

  v_height INTEGER := 0;

  v_area INTEGER := 6;

BEGIN

  v_width := v_area / v_height;

  DBMS_OUTPUT.PUT_LINE('v_width = ' || v_width);

EXCEPTION

  WHEN NO_DATA_FOUND THEN

  DBMS_OUTPUT.PUT_LINE('Division by zero');

END;

/



However I always get this error

ERROR at line 1:

ORA-01476: divisor is equal to zero

ORA-06512: at line 7

I can't debug it . I need to handle it in the right way , all exceptions should be handled.

This post has been answered by vinaykumar2 on May 16 2014
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 13 2014
Added on May 16 2014
4 comments
2,799 views