Skip to Main Content
Oracle SQL*Plus: The Definitive Guide
book

Oracle SQL*Plus: The Definitive Guide

by Jonathan Gennick
March 1999
Intermediate to advanced content levelIntermediate to advanced
528 pages
14h 39m
English
O'Reilly Media, Inc.
Content preview from Oracle SQL*Plus: The Definitive Guide

WHENEVER

The WHENEVER command controls the behavior of SQL*Plus when an operating-system or SQL error occurs, and is discussed in Chapter 7. You can choose between having SQL*Plus exit immediately or continue on whenever an error occurs. You can also choose whether to automatically COMMIT or ROLLBACK in the event of an error. Finally, if you decide to abort in the event of an error, you can pass a value back to the operating system. If you are calling SQL*Plus from an operating-system script, you can use this return value to determine that script’s next course of action.

WHENEVER {OSERROR|SQLERROR}
         {EXIT [SUCCESS|FAILURE|value|:bind_variable|]
               [COMMIT|ROLLBACK]
         |CONTINUE [COMMIT|ROLLBACK|NONE]}

where:

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 in the event that an error is returned from a SQL statement or PL/SQL block.

EXIT SUCCESS

Exit with a success status. The exact value of success is operating-system-dependent. This is the default setting, and it applies if the EXIT keyword is used without specifying any return value.

EXIT FAILURE

Exit with a failure status. The value of failure is operating-system-dependent.

EXIT value

Exit, and return the value specified as the status.

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 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Oracle SQL*Plus: The Definitive Guide, 2nd Edition

Oracle SQL*Plus: The Definitive Guide, 2nd Edition

Jonathan Gennick
Oracle PL/SQL Programming, Third Edition

Oracle PL/SQL Programming, Third Edition

Steven Feuerstein, Bill Pribyl
Oracle SQL

Oracle SQL

Dan Hotka

Publisher Resources

ISBN: 1565925785Supplemental ContentCatalog PageErrata