oracle tutorial webinars

ORA-04063

In Oracle, you can generally create an object even if there is a compilation error within the procedure or package. With such a feature, a user can deploy a schema without fixing each problem with invalid objects. Unfortunately, this is not the case for views. If there is a compilation error in a procedure, function or package within the view, it will not be created, and you will run into ORA-04063.  

The Problem

Error ORA-04063 occurs because either an attempt to execute a stored procedure was made or an attempt to use a view that has errors was made.

For stored procedures, the problem may be a syntax issue or references to other procedures that do not exist.

For views, a possible problem could be a reference in the view’s defining query to a non-existent table. This can also be a table that has references to non-existent or inaccessible types. This information is revealed when the message is expanded in the oerr utility:

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.

The Solution

To resolve ORA-04063, execute the PL/SQL query by itself in SQL*Plus. After running the query, use the SQL*Plus “show error” command to view the reason for the error and the location (by line) of the error. The syntax for this command is:

SQL  > show errors

To view enhanced show errors command feedback, join dba_errors and dba_service to view feedback within the lines of PL/SQL source code.

You may choose to use the CREATE FORCE VIEW command, which will create the view but mark it invalid. Be sure to recreate the view after you run this command.

In the following example, the package body PLOG in the schema LM_EMPLOY either does not exist or has a compilation error:

ORA-04063: package body “LM_EMPLOY.PLOG” has errors

In this case, to resolve the error, connect to the database as LM_EMPLOY user and run the following command:

SQL > alter package body plog compile;

Then use the “show error” command (SQL > show errors) to see what errors need to be corrected. 

Looking Forward

While it is difficult to proactively prevent seeing ORA-04063, it is always good practice to double check the syntax of all your commands. Make sure dependencies are correct and all variables being referenced exist.

If you continue to face problems with ORA-04063, you may consider contacting your database administrator for assistance if you are not the system DBA. Another solution may be to contact an Oracle professional to resolve the issue. Remember to always check the Oracle consultants’ credentials and certification to ensure that they have the relevant experience and expertise to help you meet your database needs.

STILL HAVE QUESTION?

Submit your question
  • This field is for validation purposes and should be left unchanged.