We are using DOS .bat files to run SQL, (don't blame me I suggested otherwise but this the way it is). It runs fine, however when the SQL fails due to a record issue the .bat does not pick up the error and continues processing. here is a sample of the code:
Here are the echos on the screen
*
ERROR at line 1:
ORA-20000: step: 01, Process aborted due to ORA-29283: invalid file operation
ORA-06512: at "job_step", line 488
ORA-29283: invalid file operation. Error number: -29283
ORA-06512: at "job_run.sql", line 766
ORA-06512: at line 1
error level is 0
no_error_574
there was no error.
Is what I am trying to find out is how to translate a failed SQL into an %errorlevel% in .bat that is greater than 0. Any suggestions?
Cretin
Code:
sqlplus -l -s user@database @job_run.sql
echo error level is %errorlevel%
REM Check for error in executing job
if %ERRORLEVEL% neq 0 goto error_574
if %ERRORLEVEL% equ 0 goto no_error_574
:error_574
echo there was an error
:no_error_574
echo no_error_574
Here are the echos on the screen
*
ERROR at line 1:
ORA-20000: step: 01, Process aborted due to ORA-29283: invalid file operation
ORA-06512: at "job_step", line 488
ORA-29283: invalid file operation. Error number: -29283
ORA-06512: at "job_run.sql", line 766
ORA-06512: at line 1
error level is 0
no_error_574
there was no error.
Is what I am trying to find out is how to translate a failed SQL into an %errorlevel% in .bat that is greater than 0. Any suggestions?
Cretin