Re: SQL Error Checking in Shell Scripts + philosophy!
Posted in 1996
Clem Akins (cwakins@leia.alloys.rmc.com) wrote:
: > 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"
: > [...]
: This isn't exactly the answer you want to hear, but IMNSHO:
I will assume that everyone following this thread has already read Clem Akins
contribution; therefore, not at all as an act of disrepect but only to save
space, I will omit his valuable input to the subject from this posting. Let me
add that I agree 100% with everything Clem has to say. I have been asked by
many a customer to perform data migrations; Clem's characterization of the
state of legacy data is most accurate if not an understatement.
In selected situations I have been successful using dbload rather than
load to migrate legacy data. When using dbload in a shell script, Icarefully assign a log file to accommodate data that contains errors and
then test that file for zero length at the end of the dbload. If the file
has zero length, I go on to the next task. If not, I send Email to the
individual whose responsibility it is to deal with the data errors.
This won't necessarily be effective in every case; it must be used selectively.
But where it is applicable, it answers the original poster's question.
___ ___ Principal Consultant
/ ) __ . __/ /_ ) _ _ __ Informix Software Inc. (303) 850-0210
_/__/ (_(_ (/ / (_(_ _/__) (-' ~/ '(_- 5299 DTC Blvd #740 Englewood CO 80111
dberg@informix.com Opinions expressed herein are my own.
Eventually all things merge into one...and a river runs through it. -N.Maclean