oracle 如何在sqlplus中显示错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/25247461/
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:27:21  来源:igfitidea点击:

How to show errors in sqlplus

oraclecompiler-errorssqlplus

提问by mlwacosmos

I would like to know how to show errors in sqlplus.

我想知道如何在 sqlplus 中显示错误。

  1. try to compile a view

    alter view SYS.DBA_XML_SCHEMAS compile;

  2. I have the message :

    ERROR at line 1:
    
    ORA-04063 : view altered with compilation errors.
    
  3. I try :

    show errors;

  4. it says :

    No errors
    
  5. I try :

    show errors view SYS.DBA_XML_SCHEMAS
    
  6. it says :

    LINE/COL  ERROR
    
    0/0       ORA-00942 : table or view does not exist
    
  1. 尝试编译一个视图

    alter view SYS.DBA_XML_SCHEMAS compile;

  2. 我有消息:

    ERROR at line 1:
    
    ORA-04063 : view altered with compilation errors.
    
  3. 我尝试:

    show errors;

  4. 它说 :

    No errors
    
  5. 我尝试:

    show errors view SYS.DBA_XML_SCHEMAS
    
  6. 它说 :

    LINE/COL  ERROR
    
    0/0       ORA-00942 : table or view does not exist
    

If I could compile with errors, the view must exist or it would tell me that the view does not exist. I dont know how to display the compilation errors of the view

如果我可以编译时出错,则视图必须存在,否则它会告诉我该视图不存在。我不知道如何显示视图的编译错误

thank you

谢谢你

回答by Alex Poole

You can query the dba_errorsview, or the all_errorsview, directly; the SQL*Plus show errorscommand seems to be a wrapper around that anyway.

您可以直接查询dba_errors视图或all_errors视图;show errors无论如何,SQL*Plus命令似乎是一个包装器。

select line, position, attribute, text
from dba_errors
where owner = 'SYS'
and type = 'VIEW'
and name = 'DBA_XML_SCHEMAS'
order by sequence;

But based on what show errorsis telling you, that will just show the same thing, error "ORA-00942 : table or view does not exist" from line 0 position 0.

但是根据show errors告诉您的内容,这只会显示相同的内容,即第 0 行位置 0 的错误“ORA-00942:表或视图不存在”。

That doesn't make much sense, but internal views are sometimes strange things, and attempting to recompile one is probably not a good idea.

这没有多大意义,但内部视图有时是奇怪的东西,尝试重新编译一个可能不是一个好主意。

You might need to get your DBA to run utlrp.sqlto recompile all invalid objectsin the database. As with anything you think of doing under the SYS schema, that should be done with care; and only if selecting from the view still says it's invalid and failed recompilation.

您可能需要让 DBA 运行utlrp.sql以重新编译数据库中的所有无效对象。与您想在 SYS 模式下做的任何事情一样,应该小心地做;并且仅当从视图中选择仍然说它无效且重新编译失败时。