How to deal with the frustrating
ORA-04068: existing state of packages has been discarded error that crops up while in the circular cycle of "code..execute..debug".
ORA-04068: existing state of packages has been discarded ORA-04061: existing state of package "PKG.PROC" has been invalidated ORA-04065: not executed, altered or dropped package "PKG.PROC" ORA-06508: PL/SQL: could not find program unit being calledPreviously, the only thing I knew to do was logout and then log back in. This works, but it is kind of a waste of time. I knew there had to be a better way because my PL/SQL Editor (PL/SQL Developer) doesn't require this step. I probably could have asked the guys at AllAround, but I think that I found the answer:
begin DBMS_SESSION.RESET_PACKAGE; -- execute routine... end;Addendum:
To respond to Abida's comment, you can run into this issue even if all the packages under your ID are valid. Your debug/test session however may not "see" the valid state of these packages. The snippet above fixes the issue with our debug/test session. Thanks, Jason