Name
WHENEVER
Synopsis
WHENEVER {OSERROR | SQLERROR} {EXIT [SUCCESS | FAILURE | value | :bind_variable |] [COMMIT | ROLLBACK] | CONTINUE [COMMIT | ROLLBACK | NONE]}
The WHENEVER command controls the behavior of SQL*Plus when an operating-system error or a SQL error occurs. For example:
WHENEVER OSERROR EXIT FAILURE WHENEVER SQLERROR EXIT FAILURE ROLLBACK
Parameters
- WHENEVER OSERROR
Use this form of the command to tell SQL*Plus what to do in the event of an operating-system error.
- WHENEVER SQLERROR
Use this form of the command to tell SQL*Plus what to do when an error is returned from a SQL statement or a PL/SQL block.
- EXIT SUCCESS
Exit with a success status.
- EXIT FAILURE
Exit with a failure status.
- EXIT value
Exit and return the value specified as the status. The value may be a literal or a user variable.
- EXIT :bind_variable
Exit and return the value of the specified bind variable as the status.
- CONTINUE
Do not exit if an error occurs. This is the default behavior when you first start SQL*Plus.
- COMMIT
May be used in conjunction with both EXIT and CONTINUE. It causes SQL*Plus to COMMIT the current transaction when an error occurs. This is the default behavior when you use the EXIT keyword.
- ROLLBACK
May be used in conjunction with EXIT and CONTINUE and causes SQL*Plus to roll back the current transaction when an error occurs.
- NONE
May only be used in conjunction with CONTINUE and causes SQL*Plus to neither COMMIT nor ROLLBACK when an error occurs. This is the default behavior when you use the CONTINUE keyword. ...
Get Oracle SQL*Plus Pocket Reference now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.