How to Properly Handle ORA-4068 Error in a PLSQL Exception Block?

(Doc ID 783675.1)

Last updated on AUGUST 30, 2017

Applies to:

PL/SQL - Version 10.2.0.4 and later
Information in this document applies to any platform.
***Checked for relevance on 24-Aug-2017***

Goal

To explain how to properly handle the following error in a PLSQL exception block:

ERROR at line 1:
ORA-04068: existing state of packages has been discarded
ORA-04061: existing state of package "user.package" has been invalidated
ORA-04065: not executed, altered or dropped package "user.package"
ORA-06508: PL/SQL: could not find program unit being called: "user.package"
ORA-06512: at line 7

When you frequently get ORA-4068 errors, you may try and suppress the error by trapping it in an exception handler and then re-executing the call.  However, when you attempt this the error does not clear itself and you get ORA-4068 repeated.  This article explains why.

Solution

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