Returning error codes from ISQL script
Posted in 1999
Topics: Error Codes & Troubleshooting
When ruuning ISQL from a shell script, is there a way to obtain the status
code upon competion.
I would like to know the result of the script.
i.e.
#!/bin/csh
isql DBNAME << ISQL
load from "foo.dat"
insert into DBNAMEISQL
Thanks
Informix DBA wrote:
> When ruuning ISQL from a shell script, is there a way to obtain the status
> code upon competion.
>
> I would like to know the result of the script.
>
> i.e.
>
> #!/bin/csh
>
> isql DBNAME << ISQL
> load from "foo.dat"
> insert into DBNAME> ISQL
>
If ISQL returns an error code, you can trap it with $? (as someone else
suggested).
IIRC, ISQL does not return a meaningful error code. That was one reason I
wrote SQLCMD, which is available from the IIUG web site
(http://www.iiug.org/). With SQLCMD, you can control what happens in the
error handling (stop or continue) for each statement. SQLCMD does return an
error status (0 OK
or 1 failed) when it stops. However, if it is ignoring errors at the time it
exits, it will exit successfully.
--
Yours,
Jonathan Leffler (jleffler@informix.com) #include
Guardian of DBD::Informix v0.60 (v0.61_02) -- http://www.perl.com/CPAN
Informix IDN for D4GL & Linux -- http://www.informix.com/idn