ORA-04068: Existing state of packages has been discarded

To avoid after changing a Package/Procedure/Function… such a Exception

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

it is necessary to:

  • disconnect and reconnect
    or
  • execute  sys.dbms_session.reset_package

before running/starting the same Procedure/Function

More Information can be found here.