捕获 Sybase IQ 中的错误 SQL 在 ksh shell 脚本中使用 dbisqlc 执行

To Capture the Error in Sybase IQ SQL Execution using dbisqlc inside ksh shell Script

我有一个如下所示的 shell 脚本,我通过它通过 dbisqlc 连接 Sybase IQ。

如果在脚本执行过程中发生任何错误,我想捕获错误。我编码如下。但是即使 SQL Execution 有任何失败, Return 计数总是 0.

dbisqlc -c "uid=UID;pwd=PWD;eng=DEV;links=tcpip(host=XXXX;port=XXX)" -q   Query.sql  OutputDumpFile   
RC=`echo $?`
if [ $RC != 0 ]
then
    echo "ERROR: Error in DB Query Execution"
fi

请帮助如何在 UNIX 中为 Sybase IQ 捕获 SQL 错误

根据 this documentationdbisql 优于 dbisqlc

It is recommended that you use the Interactive SQL utility (accessed by using the dbisql command or by choosing Start » Programs » SQL Anywhere 11 » Interactive SQL) where possible because the dbisqlc utility does not support all the features that Interactive SQL does

接着说:

Only the dbisql utility has the ability to provide exit codes from a SQL script.

因此,基于此,在我看来 dbisqlc 不会通过退出代码传达信息。