"ORA-04068:包的现有状态已被丢弃 ORA-04065:未执行、更改或删除存储过程

2021-12-24 00:00:00 oracle11g oracle plsql

当我尝试在过程CALLING_PROCEDURE_NAME"下执行过程PROCEDURE_NAME"时出现以下错误.但是我的 PROCEDURE_NAME 已经处于有效状态并成功用于其他一些程序.

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

推荐答案

但是我的 PROCEDURE_NAME 已经处于有效状态并且成功使用在其他一些程序中.

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. 您可以执行DBMS_SESSION.RESET_PACKAGE;在使调用完成运行的 PL/SQL 调用之后释放内存、游标和包变量.

  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.

您可以关闭所有现有会话并重新执行.

You could close all existing sessions and re-execute.

您可以制作软件包,SERIALLY_REUSABLE 软件包通过使用 PRAGMA SERIALLY_REUSABLE; 语句.如果一个包是 SERIALLY_REUSABLE,它的包状态存储在系统全局区 (SGA) 的一个小池中的工作区中.包状态仅在服务器调用期间保持不变.

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.

相关文章