Re: stop dbaccess when a statement in a sql script fails
Posted in 2000
May be it was an undocumented feature once. I did find this documented
in the Informix Guide to SQL: Reference manual.
Chapter 3 discusses all Environment Variables and DBACCNOIGN is
documented on page 29 in chapter 3.
I read this (manual) from the answers online section at the informix
site.
Informix Guide to SQL Reference
Informix Extended Parallel Server, Version 8.3
Informix Dynamic Server.2000, Version 9.2
December 1999
Part No. 000-6526
The entire chapter is about 112 pages where it outlines some of the
known/unknown environment variables. This is definitely worth reading
for all.
Thanks
Ram S.
In article <39629a2c$0$11209$7f31c96c@news01.syd.optusnet.com.au>,
"Carl Y. Wu" <carlywu2@yahoo.com> wrote:
> Thank you Bantilan! It worked.
> I think this should have been a well supported and documented feature
rather
> than an "undocumented" feature.
>
> Regards,
> Carl Y. Wu
>
> Bantilan, Artemius Ian wrote in message
<8jsh0i$5ft$1@news.xmission.com>...
> >
> >Hi,
> >Taken from the IIUG faq.
> >5.15 How can I stop an SQL script if an error occurs?
> >girsch@iname.com (Thomas J. Girsch) writes:-
> >If you create an SQL text file, you can run it with dbaccess by
doing:
> >$ dbaccess <database> <sql-file>> >This will run the SQL command without firing up the menu interface.
Note,
> >however, that all the statements will run, even if some in the
middle fail.
> >For example, if you run this batch that way:
> >BEGIN WORK;
> >INSERT INTO history
> >SELECT *
> >FROM current
> >WHERE month = 11;
> >DELETE FROM current
> >WHERE month = 11;> >COMMIT WORK;
> >If the INSERT statement fails, the DELETE statement still executes,
as does
> >the commit work. This could be very bad. This behavior can be
changed by
> >setting an undocumented (to my knowledge) environmental variable,
> >[Maintainers note n 18th Dec 1997 richard_thomas@yes.optus.com.au
(Richard
> >Thomas) corrected the name of the environment variable]
> >DBACCNOIGN=1
> >
> >
> >
> >> -----Original Message-----
> >> From: Carl Y. Wu [SMTP:carlywu2@yahoo.com]
> >> Sent: Tuesday, July 04, 2000 3:56 PM
> >> To: informix-list@iiug.org
> >> Subject: stop dbaccess when a statement in a sql script fails
> >>
> >> When using dbaccess to run a batch SQL script, how to instruct
dbaccess> to
> >> stop when a sql statement fails?
> >>
> >> For example, if mysqlscript.sql contains the following statement:
> >>
> >> BEGIN WORK;
> >> DELETE FROM mytable1 WHERE ......;
> >> INSERT INTO mytable2 VALUES (......);> >> COMMIT WORK;
> >>
> >> If the delete fails the insert will still be executed and the
transaction
> >> will be committed. Is there any way to let dbaccess stop when any
of the
> >> statement fails?
> >>
> >> Regards,
> >> Carl Y. Wu
> >>
> >>
> >>
> >>
>
>
Sent via Deja.com http://www.deja.com/
Before you buy.