Oracle PL/SQL - Handling exceptions without halting the program

Description

Handling exceptions without halting the program

function f_get_speed_nr(i_distance_nr NUMBER, i_timeSec_nr NUMBER)
  return NUMBER
  is
    v_out_nr NUMBER;
  begin                                                                  


    begin                                                                
       v_out_nr:= i_distance_nr/i_timeSec_nr;
    exception
          when zero_divide then
           insert into t_logError (error_tx)
           values ('Divide by zero in the F_GET_SPEED_NR');
    end;                                                                


    return v_out_nr;                                                    
end;

Related Topic