SQL> --
SQL>
SQL> create or replace function f_get_speed(i_distance NUMBER, i_timeSec NUMBER)
2 return NUMBER
3 is
4 v_out NUMBER;
5 begin
6
7 begin
8 v_out:= i_distance/i_timeSec;
9 exception
10 when zero_divide then
11 DBMS_OUTPUT.put_line('Divide by zero in the F_GET_SPEED');
12 end;
13 return v_out;
14 end;
15 /
Function created.
SQL>
SQL> select f_get_speed(1, 0) from dual;
F_GET_SPEED(1,0)
----------------
Divide by zero in the F_GET_SPEED
SQL>