oracle 获取 SQL Plus 以显示更详细的错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21160983/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 02:10:44  来源:igfitidea点击:

Get SQL Plus to display more detailed errors

oracleplsqlsqlplus

提问by user1578653

When installing my application, users must start SQL Plus and run an SQL script. This script contains creates many tables and many PL/SQL functions and triggers etc.

安装我的应用程序时,用户必须启动 SQL Plus 并运行 SQL 脚本。该脚本包含创建许多表和许多 PL/SQL 函数和触发器等。

At the moment some of the functions are in the wrong order in the script and so users currently see a few "trigger created with compilation errors" type messages. I believe this is because the functions/triggers rely on other functions which means they cannot compile correctly.

目前,一些函数在脚本中的顺序有误,因此用户目前会看到一些“因编译错误而创建的触发器”类型的消息。我相信这是因为函数/触发器依赖于其他函数,这意味着它们无法正确编译。

What I would like to do is to find out which ones are failing and what the specific compilation error was instead of the rather vague warning I get at the moment. This way I can rearrange the functions in my install script and get no more warnings!

我想做的是找出哪些失败以及具体的编译错误是什么,而不是我目前得到的相当模糊的警告。这样我就可以重新排列我的安装脚本中的功能并且不再收到警告!

UPDATE

更新

I would also like the specific errors to be logged into a file. At the moment I'm using the SPOOL command to log things, so it would be great if the errors could be 'spooled' too.

我还希望将特定错误记录到文件中。目前我正在使用 SPOOL 命令来记录事情,所以如果错误也可以“假脱机”,那就太好了。

回答by Wernfried Domscheit

You can append show errors;after creation of procedures/triggers in order to see detailed error message.

您可以show errors;在创建过程/触发器后追加以查看详细的错误消息。

回答by San

You can add show error select * from all_errors where name='<object_name>' order by sequenceafter each compilation command.

您可以在每个编译命令之后添加show errselect * from all_errors where name='<object_name>' order by sequence