|
|
ORA-04063 table/view Has Errors Tips
Oracle Database Tips by Donald Burleson
Updated March 17, 2015
|
Question: I am running a Java
program that calls a stored procedure and I get this error:
ORA-04063: view "AR.GPE" has errors
How to I see the specific error from the
ORA-04063 error?
Answer: You use the
oerr utility to see what to
do with the ORA-04063 error:
ORA-04063: table/view has errors
Cause: Attempt to execute a
stored procedure or use a view that has errors. For stored
procedures, the problem could be syntax errors or references to other,
non-existent procedures. For views, the problem could be a
reference in the view's defining query to a non-existent table. Can
also be a table which has references to non-existent or inaccessible
types.
Action: Fix the errors and/or create referenced objects as
necessary.
You need to execute the PL/SQL independently (within SQL*Plus) and
then use the
show
errors command to see the exact error message.
This will enhance the ORA-04063 and show you the exact line of
PL/SQL and reason for the error.
*****************************************************************************
In some cases, the ORA-04063 error is caused when a PL/SQL
procedure of package becomes invalid after a change to a subordinate
procedure or a schema (table) change.
ORA-04063: package body "xxx" has
errors
To resolve this ORA-04063, I would start by trying to re-compile the package and see what the
error is using:
ALTER PROCEDURE | FUNCTION| PACKAGE [<schema>.] <name> COMPILE [BODY]
I use a script to recompile PL/SQL packages. Because compiling
PL/SQL involves getting all PL/SQL within other PL/SQL procedures, you
may need to run this several times to successfully compile all of the
PL/SQL:
set heading off;
set feedback off;
set echo off;
Set lines 999;
Spool run_invalid.sql
select
'ALTER ' || OBJECT_TYPE || ' ' ||
OWNER || '.' || OBJECT_NAME || ' COMPILE;'
from
dba_objects
where
status = 'INVALID'
and
object_type in ('PACKAGE','FUNCTION','PROCEDURE')
;
spool off;
set heading on;
set feedback on;
set echo on;
@run_invalid.sql
For more
Oracle PL/SQL scripts,
check out our
collection
of over 600 Oracle PL/SQL scripts!
|