Re: SQL Error Checking in Shell Scripts + philosophy!
Posted in 1996
*
* Is there a graceful way to abort a shell script when an SQL error occurs?
* Currently, we are using shell scripts to run SQL to load flat files
* into tables using the following syntax:
* isql <database> load from "filename" insert into "tablename"
* [...]
The only way I've gotten it to work, and by no means 100% reliable, is like:
# my shell script
s=`isql <database> 2>/dev/null <<!
load from "filename" insert into "tablename";!`
if test "$s" = "" ; then
echo "OK"
else
echo "Failed"
fi
HTH,
Robert Minter Data Systems Support \\\\\\_///
Senior Software Engineer A Client Technologies Company ( _ _ )
E-Mail: rob@dssmktg.com Tel: 714.771.0454 (| ^ |)
#include <disclaimer.h> Fax: 714.771.3028 \\`-'/
De Colores - Emmaus OC-13 SURF'S UP \\_/