Re: Command line isql or borne-again-sql (basql)
Posted in 1993
Ihor Kinal writes:
> In article <2dikgiINN90v@emory.mathcs.emory.edu>, alan@po.den.mmc.com (Alan Popiel) writes:
> > I have found that the following
> > syntax also works:
> >
> > isql dbname - <<EOF
> > select ....> > EOF
> >
>
> WARNING: the above method of using 'here' documents
> is officially NOT supported by INFORMIX!!!!
>
> [some text deleted]
> Anyway, be aware that if you do use this approach, that as
> a minimum, if you're concerned about the results of the ISQL,
> you should trap the error output, and do appropriate analysis
> to check the results. Simpley checking the return code from
> the isql might not be sufficient.
The problem with this method is that if you have multiple SQL statements
and the first one fails, the rest of the statements will still be executed.
If these later statements needed the failed statement to succeed in order
to work properly, then trouble is likely to occur (seriousness would depend
on the statements being executed - inserts, deletes and updates could really
make life interesting). I assume it is just providing the same behavior
as working interactively -- if a statement fails interactively, you have
the chance to evaluate and decide if you want to type in the next statement
or not. Unfortunately, in the above example, there is no way to tell it
whether the next statement should be run or not.
Also, I believe the exit status of the isql command will reflect the
success or failure of the LAST SQL statement -- a statement in the middle
could fail and you could still get a good exit status.
The form "isql dbname sqlname", where <sqlname> is the name of the script
containing the SQL statements, will fail on the first failed statement.
Thus later statements, which may depend on the success of the failed
statement, will not be executed.
--
Bryan Klopfenstein bryan@carsinfo.com
CARS Information Systems Corp.
Cincinnati, OH Standard Disclaimers Apply