Re: ISQL Begin Work & Commit Work
Posted in 1997
Rudy Fernandes (rferdy@kuwait.net) wrote: >X-Informix-List-Id: <news.35153> > >In article <5g0vun$1m@cssun.mathcs.emory.edu>, > zprj1@nottscc.gov.uk (Jevon Richard) wrote: >>Please could anyone tell me how to use the BEGIN WORK, COMMIT WORK and >>ROLLBACK statements in ISQL. >> >>The main question is How do you find out what the status of an UPDATE, >>INSERT so to determine whether to ROLLBACK or COMMIT WORK ?? > >As far as I can determine, there seems to be an implicit >'WHENEVER ERROR STOP' for all isql statements. That is, if >isql runs into an erroneous statement, it will stop and ask >for instructions, simultaneously indicating the offending >statement and a reasonably good idea of the cause of the >problem. If you are using ISQL in the interactive mode (via the menu options), this statement is correct -- ISQL stops on every error (and on a few warnings, such as a DELETE statement with no WHERE clause). On the other hand, if you are using it in the script-driven batch mode (where you run "isql database script" or its equivalents), then the behaviour is much more like WHENEVER ERROR CONTINUE. It will report the error, but then blithely proceed to the next statement. There is no control over this. DB-Access behaves the same as ISQL in both screen-mode and batch mode. If it's a problem, try using SQLCMD from http://www/iiug.org (or, if you ask me very nicely, get a more recent version from me). It allows you to decide whether to stop or to continue on an error, and you can change the mode on the fly, and you can save the previous mode if you don't know it on a stack of modes and then restore the previous mode. Etc. SQLCMD only has a batch mode, though. Yours, Jonathan Leffler (johnl@informix.com) #include <disclaimer.h>