title: PL/SQL exception handling in function
body: <p>I am trying to generate DIVIDE_BY_ZERO exception in my oracle PL/SQL program. I using function but when I run my program I am getting error which is shown below. Can anyone tell me what is wrong in my program ?</p>
  
  <p>code:</p>
  
  <pre><code> CREATE OR REPLACE 
  PACKAGE CALCULATOR AS 
  
    FUNCTION AddNumber(addend IN Number, Addend2 IN Number) RETURN NUMBER;
    FUNCTION DivNumber(divend IN Number, divend2 IN Number) RETURN NUMBER;
  
  END CALCULATOR;
  /
  
  CREATE OR REPLACE
  PACKAGE BODY CALCULATOR AS
  
    FUNCTION AddNumber(addend IN Number, Addend2 IN Number) RETURN NUMBER AS
    BEGIN
       return addend + addend2; 
  
    END AddNumber;
  
    FUNCTION DivNumber(divend IN Number, divend2 IN Number) RETURN NUMBER AS
    BEGIN
           return divend / divend2;
           EXCEPTION 
           WHEN ZERO_DIVIDE THEN
           NULL;    
    END DivNumber;
  
  END CALCULATOR;
  /
  
  select calculator.AddNumber(3,4) from dual;
  select calculator.DivNumber(12,0) from dual;
  </code></pre>
  
  <p>output:</p>
  
  <p><a href="https://i.stack.imgur.com/o3uQd.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/o3uQd.png" alt="enter image description here"></a></p>