Posted By

bbrumm on 02/21/17


Tagged

sql Oracle


Versions (?)

Oracle SQLCODE Function


 / Published in: SQL
 

URL: http://www.databasestar.com/oracle-sqlcode/

A few examples of the SQLCODE function.

  1. /*
  2. SQLCODE Examples
  3. */
  4.  
  5. EXCEPTION
  6. WHEN OTHERS THEN
  7. dbms_output.put_line('An error was encountered: '||SQLCODE||' - '||SQLERRM);
  8. END;
  9.  
  10.  
  11.  
  12. EXCEPTION
  13. WHEN OTHERS THEN
  14. raise_application_error(-20010, 'An error was encountered: '||SQLCODE||' - '||SQLERRM);
  15. END;
  16.  
  17.  
  18. EXCEPTION
  19. WHEN OTHERS THEN
  20. errorcode := SQLCODE;
  21. errormessage := SQLERRM;
  22.  
  23. INSERT INTO error_log (error_number, error_message, function_name)
  24. VALUES (errorcode, errormessage, 'thisFunction');
  25.  
  26. END;

Report this snippet  

You need to login to post a comment.