Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Return ErrorLevel == 1 (or non zero) if compare does not match

710677Sep 10 2009 — edited Sep 10 2009
All,
I have several scheduled processes that run every week. I use a job scheduler that calls a batch file. The batch file connects to sqlplus and runs the specified sql file. For the process in question, there is a table that has a report date. If the report date is not equal to the date I want, I would like the sql script to terminate / exit and return an errorlevel code of 1 (or non zero) and not run the rest of the script. If the report dates are equal, I would like the script to complete. I have tried using an if statement, raise_application_error, goto, etc…and I can get the sql script to terminate. However, I cannot get it to return an errorlevel code of 1 (or non zero) to my batch file. It always returns an errorlevel == 0 or successful. Does anyone have any suggestions that will execute a date compare and error out / return errorlevel == 1 (or whatever) if the dates do not match? Any help you give would be greatly appreciated.

Thanks,
cc
This post has been answered by LKBrwn_DBA on Sep 10 2009
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 8 2009
Added on Sep 10 2009
4 comments
1,041 views