Sqlplus exit whenever sqlerror

sqlplus exit whenever sqlerror

Oracle Database Tips by Donald BurlesonMay 7, echo "SQLPLUS failed" 3 - Use the WHENEVER SQLERROR EXIT sprers.euE. the SQLPLUS script will end, and the sql error number will be the exit code. This is useful in Unix/Linux (or other OS) shell scripts. When. The WHENEVER SQLERROR EXIT command catches any errors in a PL/SQL block, but only if those errors are raised back to the SQL*Plus level. PL/SQL has its own.

Sqlplus exit whenever sqlerror - opinion you

FAILURE CONTINUE [COMMIT FAILURE FAILURE n variable n n variable variable wc -l = 0
then
   echo "SQLPLUS failed"

 

2 - Test for the general error status of the sqlplus job:

sqlplus > /tmp/sprers.eu

if [[ $? -ne 0 ]]
then
  echo "SQLPLUS failed " $?
  cat sprers.eu

3 - Use the WHENEVER SQLERROR EXIT sprers.euE

4 Use the errorlevel validation commands.  For example, sqlplus exit whenever sqlerror, this script checks to see that the SQL*Plus executed successfully and branches for a non-zero error level:

sqlplus . . .  > /u01/app/oracle/scripts/sprers.eu 2>&1

if %ERRORLEVEL% ==  0 GOTO SQL_SUCCESSFUL
if %ERRORLEVEL% NEQ 0 GOTO SQL_ERROR

:SQL_ERROR
echo "THE SQL SCRIPT FAILED"
GOTO END

:SQL_SUCSESSFUL
ECHO "SQL WAS SUCCESSFUL"
GOTO End