Return ErrorLevel == 1 (or non zero) if compare does not match
710677Sep 10 2009 — edited Sep 10 2009All,
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