Receiving ORA-4061 After Modifying A PL/SQL Body (Doc ID 444968.1)

Last updated on JULY 08, 2016

Applies to:

Oracle Database - Enterprise Edition - Version 10.2.0.2 and later
Information in this document applies to any platform.
***Checked for relevance on 08-Jul-2016***

Symptoms

After modifying the PL/SQL package body in one session and selecting it in different session will give ORA-04061 error. This behavior is a bug (<Bug 2747350>) and is fixed in 10.2.0.2.

But still you are seeing the following behavior in 10.2.0.2. The ORA-04061 error still appears.

Session 1: Create the package
==========
.
SQL>create or replace package test_pkg
is
x CONSTANT NUMBER := 1;
function getInfo return date;
end;
.
SQL>create or replace package body test_pkg
is
function getInfo return date is
begin
return sysdate;
end;
end;
.
SQL>select test_pkg.getinfo from dual;
.
Session 2: Query the package's function
==========
.
SQL>select test_pkg.getinfo from dual;
.
Session 1: Recompile the package body
==========
.
SQL>create or replace package body test_pkg
is
function getInfo return date is
begin
return sysdate;
end;
end;
.
Session 2: Query the package's function again
==========
.
SQL>select test_pkg.getinfo from dual;

 
This will give the error 

ORA-4061: existing state of package body has been invalidated ORA-4061:

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