How to exit dbaccess if sqlerror ..!
Posted in 1999
Topics: SQL Development & Query Writing, Error Codes & Troubleshooting, Connectivity: ESQL/C, 4GL & Embedded SQL, Server Administration
I am running multiple/sequential sql statements contained in a sql file using
'dbaccess' under unix/informix environment .. If one of the sql statements
fail I would like to exit out, without processing any of the subsequent sql
statements .. If I had to do something similar in ORACLE environment with
'sqlplus', I would do something like the following ..
sqlplus user/passwd@somewhere <<!
whenever sqlerror exit sql.sqlcode;
select count(*) from xxx;
select count(*) from yyy;!
If in the above code the first select count(*) fails then sqlplus exits out
without processing the second select statement .. I like to do a similar thing
in Informix preferably with dbaccess .. Any suggestions .. !
I know that I can wrap each of the sql with a shell and check for error and
exit out if needed .. But that is not an option for me since I am creating
temporary tables that will be lost when I close the dbaccess session and open
another .. ! I do not want to use any procedural language like 4GL or esqlc
either .. I would like to accomplish this with dbaccess or a similar tool ..
Any input will be greatly appreciated ..
-Thanks
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own