Generic error handling to handle any type of error : Handle Exception « PL SQL « Oracle PL / SQL






Generic error handling to handle any type of error

    

SQL>
SQL> declare
  2      str  varchar2(50);
  3  begin
  4      str := 'CAT';
  5  exception
  6      when others then
  7          raise_application_error (-20100, 'error#' || sqlcode || ' desc: ' || sqlerrm);
  8  end;
  9  /

PL/SQL procedure successfully completed.

SQL>
SQL>
SQL>

   
    
    
    
  








Related examples in the same category

1.A procedure that uses a WHEN OTHERS clause
2.Check and output sqlcode sqlerrm
3.noroom exception
4.Use exception handler to mark success flag