ORA-04063 Package Body "SYS.DBMS_STATS" Has Errors (Doc ID 604457.1)

Last updated on DECEMBER 06, 2016

Applies to:

Oracle Database - Enterprise Edition - Version 9.2.0.8 and later
Information in this document applies to any platform.
***Checked for relevance on 04-Feb-2016***

Symptoms

-- Problem Statement:

A job that updates stats is failing with:
ERROR at line 1:
ORA-04068: existing state of packages has been discarded
ORA-04063: package body "SYS.DBMS_STATS" has errors
ORA-06508: PL/SQL: could not find program unit being called
ORA-06512: at line 1

The package body shows invalid in dba_objects:

SQL> select owner, object_name, object_type, status from dba_objects
 where object_name = 'DBMS_STATS';

OWNER   OBJECT_NAME  OBJECT_TYPE   STATUS
-----    --------      -----       -------
SYS     DBMS_STATS   PACKAGE       VALID
SYS     DBMS_STATS   PACKAGE BODY  INVALID
PUBLIC  DBMS_STATS   SYNONYM       VALID


When try to compile the package, it gives errors.

SQL> show user
USER is "SYS"
SQL> alter package DBMS_STATS compile body;
Warning: Package Body altered with compilation errors.

SQL> show errors
Errors for PACKAGE BODY DBMS_STATS:

LINE/COL ERROR
-------- -----------------------------------------------------------------
7109/5 PLS-00394: wrong number of values in the INTO list of a FETCH statement
7109/5 PL/SQL: SQL Statement ignored

 

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms