Exits SQL*Plus if an operating system error occurs (such as a file I/O error).
Syntax
WHENEVER OSERROR {EXIT [SUCCESS|FAILURE|n|variable] [COMMIT|ROLLBACK]|CONTINUE [COMMIT|ROLLBACK|NONE]}
Terms and Clauses
Refer to the following list for a description of each term or clause:
If you do not enter the WHENEVER OSERROR command, the default behavior of SQL*Plus is to continue and take no action when an operating system error occurs.
Examples
The commands in the following command file cause SQL*Plus to exit and COMMIT any pending changes if a failure occurs when writing to the output file:
WHENEVER OSERROR EXIT SQL.OSCODE COMMIT SPOOL MYLOG UPDATE EMP SET SAL = SAL*1.1 COPY TO SCOTT/TIGER@HQDB - REPLACE EMP - USING SELECT * FROM EMP SPOOL OUT SELECT SAL FROM EMP