Use when to catch exceptions : When « PL SQL « Oracle PL / SQL






Use when to catch exceptions

SQL>
SQL> -- catch Exception
SQL>
SQL>  declare
  2      l_number number;
  3    begin
  4      l_number := 'MY NUMBER';
  5    exception
  6      when OTHERS then
  7        dbms_output.put_line('Exception caught');
  8        raise;
  9    end;
 10    /
Exception caught
 declare
*
ERROR at line 1:
ORA-06502: PL/SQL: numeric or value error: character to number conversion error
ORA-06512: at line 8


SQL>

           
       








Related examples in the same category

1.Use when inside case
2.Exit when loop