WHENEVER SQLERROR EXIT command in Oracle SQL*Plus


'WHENEVER SQLERROR EXIT' command directs SQL*Plus to to exit from SQL*Plus when it encounters a SQL command error or PL/SQL error. It does not exit for SQL*Plus command error.

Syntax
  • WHENEVER SQLERROR EXIT
    • Commits and exits SQL*Plus error for any SQL or PL/SQL Error.
  • WHENEVER SQLERROR EXIT COMMIT
    • Commits any pending transaction and exits SQL*Plus error for any SQL or PL/SQL Error.
  • WHENEVER SQLERROR EXIT ROLLBACK
    • Rollbacks any pending transaction and exits SQL*Plus error for any SQL or PL/SQL Error.
  • WHENEVER SQLERROR EXIT <number_exit_code>
    • Commits and exits SQL*Plus error for any SQL or PL/SQL Error and returns the number as exit code to the OS.
  • WHENEVER SQLERROR EXIT SQL.SQL_CODE
    • Commits and exits SQL*Plus error for any SQL or PL/SQL Error and returns the error code from the SQL as exit code to the OS.

Watch the below video for a detailed tutorial & demo on this topic.
=======================================================================
** Email to info@shreyantech.com to get the Tip of the Day in your mailbox.

No comments:

Post a Comment