"ORA-04068: existing state of packages has been discarded ORA-04065: not executed, altered or dropped stored procedure

放肆的年华 提交于 2019-12-30 02:16:16

问题


i m getting below error when i m trying to execute procedure "PROCEDURE_NAME" under procedure "CALLING_PROCEDURE_NAME". But my PROCEDURE_NAME is already in valid state and successfully using in some other procedures.

ORA-04068: existing state of packages has been discarded
ORA-04065: not executed, altered or dropped stored procedure ""PROCEDURE_NAME""
ORA-06508: PL/SQL: could not find program unit being called: ""PROCEDURE_NAME""
ORA-06512: at ""CALLING_PROCEDURE_NAME"", line LINE_NO
ORA-06512: at line 1

回答1:


But my PROCEDURE_NAME is already in valid state and successfully using in some other procedures.

The session where the package is currently called, it retains that state of the package. If you recompile the package, then the moment the package is called in that session again, you will hit this error.

  1. You can execute DBMS_SESSION.RESET_PACKAGE; to free the memory, cursors, and package variables after the PL/SQL call that made the invocation finishes running.

  2. You could close all existing sessions and re-execute.

  3. You could make the package, SERIALLY_REUSABLE Packages by using PRAGMA SERIALLY_REUSABLE; statement. If a package is SERIALLY_REUSABLE, its package state is stored in a work area in a small pool in the system global area (SGA). The package state persists only for the life of a server call.



来源:https://stackoverflow.com/questions/26646123/ora-04068-existing-state-of-packages-has-been-discarded-ora-04065-not-execute

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!