简体   繁体   中英

How to retrieve the missing column or missing table from an invalid package in Oracle?

我的表中有无效的对象,例如包或过程,我是否可以使用sqlplus脚本或sql脚本来检索包所需的丢失的表或字段?

First, try to compile to schema to get the smallest set of errors:

CONN myuser/mypass@mydb
EXEC UTL_RECOMP.recomp_serial(USER);

Next, you can get a list of all the outstanding errors:

SELECT * FROM user_errors;

Now, this will show you the object (package, procedure, error), and the line number with the error. You can join this to user_source for example to get show the lines of code, for example (not tested - shown here just for a hint):

select e.error_text, s.type, 
       s.name, s.line, e.line
from user_errors e, user_source s
where s.name = e.name
and  s.type = e.type
and  s.line between (e.line-2) and (e.line+2) -- context 
order by s.type, s.name, e.line, s.line;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM