This script demonstrates error functions SQLERRM and SQLCODE : sqlcode « PL SQL « Oracle PL / SQL






This script demonstrates error functions SQLERRM and SQLCODE

   
SQL>
SQL> SET SERVEROUTPUT ON
SQL> DECLARE
  2     v_error VARCHAR2(10);
  3  BEGIN
  4     SELECT dummy INTO v_error FROM dual WHERE 1=2;
  5  EXCEPTION
  6     WHEN OTHERS
  7     THEN
  8        DBMS_OUTPUT.PUT_LINE('SQLERRM: '||SQLERRM);
  9        DBMS_OUTPUT.PUT_LINE('SQLCODE: '||SQLCODE);
 10  END;
 11  /
SQLERRM: ORA-01403: no data found
SQLCODE: 100

PL/SQL procedure successfully completed.

SQL>
SQL>

   
    
    
  








Related examples in the same category

1.sql code and sql errm
2.Get error count from sql%bulk_exceptions.count