Run script serie with stop if error in .bat

March 4, 2011 at 01:33:33
Specs: Windows XP

I would like to write a bat or a shell that run stand-alone sql scripts and stop if a query don't succeed.

I wrote yet a bat (to run sql via dbaccess) and a shell sh (to run sql via sqlplus) there concatene all sql scripts and run the obtained script, but in this case, I can't correct a bad sql script before run the next script.

This is my problem. If I run the next scrit while the previous return an error, I take the risk that the databasa update to be corrupted.

So, I want to list the scripts in the directory
Run the first script
Retrieve the result (succeed or error)
Run the next script if the previous succeed
Or stop if the script return an error
And print all queries and result in a file.log

You can read the bat and the shell in this post :


See More: Run script serie with stop if error in .bat

Report •

March 4, 2011 at 01:42:10
Just a precision... the name file looks like this :

- Oracle => mig_V9.1.101_ora.sql

- Informix => mig_V9.1.101_ifx.sql

Report •
Related Solutions

Ask Question