Friday, April 15, 2011

Checking errors in procedures

If you have a procedure or package that didn't compile properly, you can check the errors and related lines of code with this SQL statement:

SQL> column TEXT format a30
SQL> select e.NAME, e.TYPE, e.TEXT as ERROR, s.TEXT as CODE
from dba_errors e join dba_source s on
(e.OWNER=s.OWNER and e.NAME=s.NAME and e.TYPE=s.TYPE and e.LINE=s.LINE)
where e.OWNER in ('MYUSER') order by e.OWNER, e.NAME, e.LINE;

NAME TYPE ERROR
--------------- ------------ ------------------------------------------------
CODE
----------------------------------------------------
MYPACKAGE PACKAGE BODY PL/SQL: ORA-00942: table or view does not exist
INSERT INTO mytable@my.dblink

MYPACKAGE PACKAGE BODY PL/SQL: SQL Statement ignored
INSERT INTO mmytable@my.dblink

MYPACKAGE PACKAGE BODY PL/SQL: ORA-00942: table or view does not exist
SELECT count("myfield") INTO afield

MYPACKAGE PACKAGE BODY PL/SQL: SQL Statement ignored
SELECT count("myfield") INTO afield

No comments:

Post a Comment