SQL*Plus User's Guide and Reference Release 8.1.6 A75664-01 |
|
Command Reference, 24 of 52
Terminates SQL*Plus and returns control to the operating system.
{EXIT|QUIT} [SUCCESS|FAILURE|WARNING|n|variable|:BindVariable] [COMMIT|ROLLBACK]
Refer to the following list for a description of each term or clause:
EXIT with no clauses commits and exits with a value of SUCCESS.
EXIT allows you to specify an operating system return code. This allows you to run SQL*Plus command files in batch mode and to detect programmatically the occurrence of an unexpected event. The manner of detection is operating-system specific. See the Oracle installation and user's manual(s) provided for your operating system for details.
The key words SUCCESS, WARNING, and FAILURE represent operating-system dependent values. On some systems, WARNING and FAILURE may be indistinguishable.
The range of operating system return codes is also restricted on some operating systems. This limits the portability of EXIT n and EXIT variable between platforms. For example, on UNIX there is only one byte of storage for return codes; therefore, the range for return codes is limited to zero to 255.
If you make a syntax error in the EXIT options or use a non-numeric variable, SQL*Plus performs an EXIT FAILURE COMMIT.
For information on exiting conditionally, see the WHENEVER SQLERROR and WHENEVER OSERROR commands later in this chapter.
The following example commits all uncommitted transactions and returns the error code of the last executed SQL command or PL/SQL block:
SQL> EXIT SQL.SQLCODE
The location of the return code depends on your system. Consult your DBA for information concerning how your operating system retrieves data from a program. See the TTITLE command in this chapter for more information on SQL.SQLCODE.
|
![]() Copyright © 1999 Oracle Corporation. All Rights Reserved. |
|