PL/SQL Package invalidated
        Posted  
        
            by FrustratedWithFormsDesigner
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by FrustratedWithFormsDesigner
        
        
        
        Published on 2010-03-23T18:48:10Z
        Indexed on 
            2010/03/23
            18:53 UTC
        
        
        Read the original article
        Hit count: 344
        
I have a script that makes use of a package (PKG_MY_PACKAGE). I will change some of the fields in a query in that package and then recompile it (I don't change or compile any other packages). I run the script and I get an error that looks like
    ORA-04068: existing state of packages has been discarded
    ORA-04061: existing state of package body "USER3.PKG_MY_PACKAGE" has been invalidated
    ORA-04065: not executed, altered or dropped package body "USER3.PKG_MY_PACKAGE"
    ORA-06508: PL/SQL: could not find program unit being called: "USER3.PKG_MY_PACKAGE"
    ORA-06512: at line 34
I run the script again (without changing anything else in the system) and the script executes successfully.
I thought that when I compiled before I executed the script that would fix any invalid references. This is 100% reproducible, and the more I test this script the more annoying it gets. What could cause this, and what would fix it?
(oracle 10g, using PL/SQL Developer 7)
© Stack Overflow or respective owner