Skip to Content
Oct 31, 2019 at 12:26 AM

How to exit hdbsql if an error occurs while executing a script?

1057 Views Last edit Oct 31, 2019 at 12:28 AM 2 rev

I'm using HANA hdbsql to execute a SQL script containing many SQL statements. I want it to immediately stop processing the input file and exit with an error code as soon as any statement gets an error. Is there a way to do this? In Oracle's sqlplus, this functionality is enabled with "whenever sqlerror exit sql.sqlcode". I haven't found anything like this in the hdbsql documentation. Not having this capability makes it very difficult to create effective scripts. You have to be able to detect when something doesn't work and stop.