WHENEVER OSERROR CLPPlus command
The WHENEVER OSERROR CLPPlus command specifies the action the CLPPlus interface performs when an operating system error occurs. You can use this command to trap errors and control the CLPPlus interface behavior by performing specified actions like EXIT or CONTINUE.
Invocation
The WHENEVER OSERROR command must be issued from the CLPPlus interface.
Authorization
None
Required connection
None
Command syntax
Command parameters
-
CONTINUE
- Directs the CLPPlus interface to continue with a specified action when an SQL or PL/SQL error is encountered.
-
NONE
- The default value that is used in the WHENEVER OSERROR CONTINUE command. No action on the block of SQL generating an error is taken.
-
COMMIT
- When COMMIT is specified in the WHENEVER OSERROR CONTINUE command, any possible work that is done by the current SQL block is committed.
-
ROLLBACK
- When ROLLBACK is specified in the WHENEVER OSERROR CONTINUE command, all work in the current SQL block is rolled back.
-
EXIT
- Directs the CLPPlus interface to exit once an operating system error is encountered. The functionality of this option is the same as the stand-alone EXIT command.
-
SUCCESS
- Returns an operating system-dependant return code that indicates success. This is the first default EXIT parameter.
-
FAILURE
- Returns an operating system-dependant return code that indicates a failure.
-
value
- Specifies a variable that is created by the DEFINE command whose value is returned as the return code.
-
variable
- Specifies a substitution variable value that is created by the DEFINE command whose value is returned as the return code.
-
:bindvariable
- Specifies a Bind variable value that is created by the DEFINE command whose value is returned as the return code.
-
COMMIT
- Specifies that uncommitted updates are committed when the CLPPlus session ends. This is the second default EXIT parameter. ROLLBACK
- Specifies that uncommitted updates are rolled back when the CLPPlus session ends.
Examples
The following example shows the command behavior when EXIT and
an exit error value are specified.
SQL> whenever oserror exit -1
SQL> get c:\nonexistingfile.sql
DB250204E: An attempt to locate a file 'c:\\nonexistingfile.sql' failed. The co
mmand cannot be processed.
You can review the return code for by running the echo
%errorlevel% command.echo %errorlevel%
-1
The following example shows the command behavior
when CONTINUE is specified.
SQL> whenever oserror continue
SQL> get c:\nonexistingfile.sql
DB250204E: An attempt to locate a file 'c:\\nonexistingfile.sql' failed. The co
mmand cannot be processed.
SQL>