We have the following batch of script:
( echo @release.sql echo exit ) | sqlplus x/ y@orcl if %errorlevel% gtr 1 goto dberror
The problem is the statement if %errorlevel% gtr 1 never seems true when an sql error occurs.
If we put garbage commands in the release.sql file, sqlplus complains:
SQL> SP2-0042: unknown command "blah" - rest of line ignored. SQL> Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
But %errorlevel% is still 0. 0. How can we determine if there was a sql error?
Refresh . This code seems to work for some sql errors. It will work if I do a drop table blah , but it will not work only with the blah command
source share