Stop on first error when running a (DB2) database script
Hello,
I was wondering if it is possible to stop executing a database script (DB2 in my case) as soon as an error occurs.
If I run an SQL script against my DB2 databse from within IntelliJ, the whole script is run, even if halfway some statements give errors. I would like the script to fail as soon as the first error occurs (which you get with the -s option when executing scripts from command line).
Does anyone know if this is currently possible? I couldn't find a way to do it.
If not, I'll file a bug for this to be implemented.
Thanks,
Guno
Please sign in to leave a comment.
Hello.
Latest builds 138.nnn do stop on the first error and suggest options: Retry, Ignore, Ignore All, Stop. What IDEA version do you have?
Regards,
Alexander.
I'm using latest EAP (138.1980.1).
Is there some setting that controls this behaviour?
It's easy to reproduce here. I've got file.sql in my project with the following contents:
Right clicking the file and choosing Run "file.sql"... to run against my db2 database gives the following output:
As can be seen, the 2nd SELECT is executed, even though the INSERT failed. I would like it to stop right after the failed INSERT.
Greetings,
Guno
Thank you, got it. You're right: the advanced error reporting system works in the database console, but not supported when running an .sql file.
Please, take a look at the error reporting in database console: is that Ok? Then the request will be to support the same in .sql files. Or, maybe, some more functionality is required even in the console.
Regards,
Alexander.
The error reporting in database console looks ok, it'd be great if it works the same in sql files.
I've created a Youtrack issue for this:
http://youtrack.jetbrains.com/issue/IDEA-129793
Thanks!
Guno