I have a bunch of SQL scripts (with shell script wrappers) to unload data like so
Code:
EXPORT TO /tmp/out.csv OF DEL MODIFIED BY NOCHARDEL COLDEL, DATESISO
MESSAGES /tmp/out.msg SELECT WIDGETID
...
I want to add an error handler to the script the way Oracle does it
Code:
WHENEVER SQLERROR EXIT FAILURE;
SPOOL /tmp/out.csv;
SELECT WIDGETID...
SPOOL OFF;
According to DB2's documentation, this can be done in stored procedures, C, Perl, REXX....nothing else.
Has anyone done this in SQL scripts? Can you provide pointers?
Code:
Running DB2/LINUXX8664 9.7.2.`