Quote:
It's the same as with any other OS command:
Code:
#!/bin/sh
db2 load from ....
if [ $? != 0 ]; then
echo "Error!"
exit
fi
db2 load from ...
You can find more details in Command Reference
|
... except that DB2 will return an exit status of 1 for warnings (e.g. updates where no rows found, loads/imports with warnings). For loads, these warnings may actually want to be treated as errors (particularly those which have involved data mutation). So the long and the short of it is that you are going to have to check the SQLSTATES returned in the stdout to determine if you have any warnings that should be treated as errors for your particular circumstances.
At least that's what I've done in the past (using awk/grep). If you come up with a better solution, please post it.
Damian