Checking SQL return codes from a Script file?
Posted in 1995
> When you execute more than one SQL commands (a logical unit of work: UPDATE,
> INSERT, ...) in a Korn shell script, is there a way to check the *return
> codes* from each SQL command and backout the commands if one fails? If so, how
> can this be done in a script? Thanks! Lenny.
I was about to post a "you can't get there from here" but I thought of a
sleazy way around your problem. You could use a verification SQL statement,
that would return something that you could check against the intent. For
example:
To change y from 1 to 0:
$ echo "update x set y = 1 where y = 0" | isql dbname
$ echo "select y from x where y = 0" | isql dbname
Check the stdout of the second statement and compare it to what you want.
That's pretty kludgy, but $ for $ it's the best consulting you'll ever get!
Have fun,
__________________________________________________________________
| Clem Akins Standard Disclaimers Apply |
|Reynolds Metals Co, Alloys Plant "Climb High, Cave Deep!" |
| Muscle Shoals, Alabama USA cwakins@leia.alloys.rmc.com |
|________________________________________________________________|