Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
2.0k views
in Technique[技术] by (71.8m points)

oracle - How to show errors in sqlplus

I would like to know how to show errors in 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
    

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You can query the dba_errors view, or the all_errors view, directly; the SQL*Plus show errors command seems to be a wrapper around that anyway.

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 errors is telling you, that will just show the same thing, error "ORA-00942 : table or view does not exist" from line 0 position 0.

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.sql to recompile all invalid objects in 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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...