SQL>
SQL> DECLARE
2 num_a NUMBER := 6;
3 num_b NUMBER;
4 BEGIN
5 num_b := 0;
6 num_a := num_a / num_b;
7 num_b := 7;
8 dbms_output.put_line(' Value of num_b ' || num_b);
9 EXCEPTION
10 WHEN ZERO_DIVIDE
11 THEN
12 dbms_output.put_line('Trying to divide by zero');
13 dbms_output.put_line(' Value of num_a ' || num_a);
14 dbms_output.put_line(' Value of num_b ' || num_b);
15 END;
16 /
Trying to divide by zero
Value of num_a 6
Value of num_b 0
PL/SQL procedure successfully completed.
SQL>
SQL>
SQL>