我喜欢将我的oracle数据库脚本设置为在出现任何数据库或操作系统问题时失败。
我一直在考虑迁移到SQLCL,但是我为检测和触发非数据库问题的回滚而采用的SQL*Plus方法在SQLCL上失败了,我想知道是否有人有替代的解决方案(或一个好的变通办法)。
我一直在使用SET ERRORLOGGING将任何SP错误定向到SPERRORLOG,在那里我可以在提交之前检测到它们,并决定回滚/分支/继续/警报等。
我抓取了最新的sqlcl (2016年6月sqlcl-4.2.0.16.175.1027),希望修复以下问题,但它仍然存在。
当发出SET ERRORLOGGING ON时,我得到以下信息:
SQL> SET ERRORLOGGING ON
SP2-0158: unknown SET option beginning "errorloggi..."手动输入似乎表示此选项在SQLCL中没有任何其他更改。
SQL> help set errorlogging
SET ERRORLOGGING
ERRORL[OGGING]{ON|OFF}
[TABLE [schema.]tablename] [TRUNCATE] [IDENTIFIER identifier]这只是一个bug,还是需要其他东西来启动和运行ERRORLOGGING?
如果这是一个bug,有没有检测SP(2)错误的好方法?
发布于 2016-07-31 10:07:03
好吧,看起来,尽管errorlogging设置在可用的SQLcl的set设置中存在,但目前不支持它。
运行show <setting>命令以检查某个设置是否受支持。
./sql -v
SQLcl: Release 4.2.0.16.175.1027 RC
SQL> help set errorlogging
SET ERRORLOGGING
ERRORL[OGGING] {ON|OFF}
[TABLE [schema.]tablename]
[TRUNCATE] [IDENTIFIER identifier]
SQL> show errorlogging
errorlogging Unsupported发布于 2017-08-29 20:02:38
我们到了那里。它现在和latest OTN release或Oracle数据库版本上都受支持。
SQL> conn barry/oracle@localhost:1521/xe
Connected.
SQL> show errorlogging
errorlogging is OFF
SQL> set errorlogging on
SQL> show errorlogging
errorlogging is ON TABLE SPERRORLOG
SQL> select * from NOTATABLE;
Error starting at line : 1 in command -
select * from NOTATABLE
Error at Command Line : 1 Column : 15
Error report -
SQL Error: ORA-00942: table or view does not exist
00942. 00000 - "table or view does not exist"
*Cause:
*Action:
SQL> set sqlformat ansiconsole
SQL> /
USERNAME TIMESTAMP SCRIPT IDENTIFIER MESSAGE
STATEMENT
BARRY 29-AUG-17 12.55.45.000000000 ORA-00942: table
or view does not exist
select * from NOTATABLEhttps://stackoverflow.com/questions/38678450
复制相似问题