Package gets invalidated seemingly at random

Hi, I am experiencing a problem whereby a PL/SQL package is valid for same time (and runs succesfully a few times) and then suddenly becomes invalid in DB. If I recompile package it works for some time and then again gets invalid.
Do you know what might cause such strange behavior.
Also, does anyone know a way of obtaining error information from DB that reports why a package was flagged as invalid?
Also, does anyone know how to obtain dependencies (both direct and indirect) for a package?
Thanks for your help, regards,
-Javier

Thanks a lot Gio for your help. I was asking how to onbtain dependencies just because of the reason you mention.
However if I run your query I get a dependency from the package body on the package. If I run the query on the package body (which is the one that gets flagged as invalid every once in a while) it does not return any dependency.
In fact there are quite a few tables accessed inside the package but the query does not return a dependency on them. Nevertheless those tables are not supposed to be altered, and this problem repeats every day which makes me think that is not the problem.
Thanks a lot,
Javier

Similar Messages

  • FND_PROFILE package gets invalid

    Hi,
    FND_PROFILE package gets invalid, so i did like as follows:
    SQL> alter PACKAGE FND_PROFILE compile body;
    Warning: Package Body altered with compilation errors.
    SQL> show error
    Errors for PACKAGE BODY FND_PROFILE:
    LINE/COL ERROR
    99/26 PL/SQL: Item ignored
    99/50 PLS-00382: expression is of wrong type
    118/2 PL/SQL: Statement ignored
    118/6 PLS-00320: the declaration of the type of this expression is
    incomplete or malformed
    190/2 PL/SQL: Statement ignored
    190/6 PLS-00320: the declaration of the type of this expression is
    incomplete or malformed
    339/2 PL/SQL: Statement ignored
    LINE/COL ERROR
    339/6 PLS-00320: the declaration of the type of this expression is
    incomplete or malformed
    398/3 PL/SQL: Statement ignored
    398/7 PLS-00320: the declaration of the type of this expression is
    incomplete or malformed
    402/3 PL/SQL: Statement ignored
    402/7 PLS-00320: the declaration of the type of this expression is
    incomplete or malformed
    LINE/COL ERROR
    1835/2 PL/SQL: Statement ignored
    1835/6 PLS-00320: the declaration of the type of this expression is
    incomplete or malformed
    2009/2 PL/SQL: Statement ignored
    2009/6 PLS-00320: the declaration of the type of this expression is
    incomplete or malformed
    2375/2 PL/SQL: Statement ignored
    2375/6 PLS-00320: the declaration of the type of this expression is
    incomplete or malformed
    LINE/COL ERROR
    2402/2 PL/SQL: Statement ignored
    2402/6 PLS-00320: the declaration of the type of this expression is
    incomplete or malformed
    SQL>
    So, could anybody suggest, what to do now and how to proceed to make this package valid ?

    Nitesh,
    So, could you help me to know the source where i can find the valuable information related to this.To find the pls for package creation, you can also do the following in your appl_top.
    -> Go to the product top/patch/115/sql
    -> grep -i fnd_securit * | grep -i create
    You'll get an output something like this
    AFSCGRPB.pls:create or replace package body FND_SECURITY_GROUPS_PKG as
    AFSCGRPS.pls:create or replace package FND_SECURITY_GROUPS_PKG as
    AFSCUSV8.pls:CREATE OR REPLACE PACKAGE BODY fnd_security_pkg wrapped
    AFSCUSVS.pls:CREATE OR REPLACE PACKAGE fnd_security_pkg AUTHID DEFINER AS
    afpub.sql:CREATE SYNONYM FND_SECURITY_PKG FOR &1..FND_SECURITY_PKG;
    afsecctx.sql:REM | Creates the fnd_security context and invalidates any obsolete
    afsecctx.sql: execute immediate 'create context fnd_security using fnd_security_pkg';
    In these you would need the pls related to FND_SECURITY which are AFSCUSV8.pls and AFSCUSVS.pls
    -> sqlplus apps/apps @AFSCUSVS.pls (Spec)
    -> sqlplus apps/apps @AFSCUSV8.pls (Body)

  • Pl sql packages getting invalid

    Hi All,
    I am working on a OLTP VLDB oracle 10g database. I have observed that many of pl sql packages get in invalid state. There are many cronjobs , dbms jobs running 24x7. How do I find out the root cause of this?

    You can write Database DDL trigger and log DDL operation into your log table.
    Then check which statement caused it:
    CREATE OR REPLACE TRIGGER DDL_TRIG BEFORE
    ON DATABASE
      INSERT INTO YOUR_LOG_TABLE
      SELECT ora_sysevent, ora_dict_obj_owner,
      ora_dict_obj_name, NULL, USER, SYSDATE
      FROM dual You should check if table which caused trigger to fire is dependency of your desired package like
    where ora_dict_obj_name in (
      select referenced_name from dba_dependencies where name IN(YOUR_INVALIDATED_PACK_LIST) and   
       referenced_type='TABLE';
      )

  • Package getting invalid often

    Dear all,
    In our environment, one package is getting invalid automatically ..
    we are getting the error :
    ORA-06508: PL/SQL: could not find program unit being called
    This is happening regularly..no structural changes made to the package.. but the package is going into invalid state daily.. how to troubleshoot this ?
    this question might sound silly.. but in case any of you might have experienced this kinda issue?
    Kai

    Are you saying that if we call the time that a procedure in the package was last executed successfully Time 1 and the time that a procedure in the package was executed and generated the error Time 2 that there are no rows in DBA_OBJECTS with a LAST_DDL_TIME between Time 1 and Time 2?
    Does the package rely on remote objects?
    Justin

  • Cannot install Photoshop Touch, get invalid package file

    I have purchased the Photoshop Touch for phone on my Galaxy Note2 and haven't been able to install it since. It goes thru the install process, but at the end I get: ERROR PACKAGE FILE INVALID. I've gone thru this several times and it's very frustrating. Additionally, I have tried to search the forums and Google solutions, nothing is working. I've even chatted with and spoken with a couple of Adobe representatives...no success. I just keep getting referred bk to this site.  Can anyone help me either get it downloaded or tell me how I can get a refund. #paidforanappIhaveyettobeabletouse

    Please try the steps explained here:
    http://www.android-advice.com/2012/fix-android-market-package-file-is-invalid/?utm_source= feedburner&utm_medium=feed&utm_campaign=Feed%3AAndroidAdviceTutorials%28AndroidAdvice%26+Tutorials%29
    HTH

  • TS4268 Why does my Imessage not take my Apple ID and password? it has me reset it to get in, but once reset imessage still rejects the password. It seems to randomly deactivate my Imessage

    Why does my Imessage not take my Apple ID and password? it has me reset it to get in, but once reset imessage still rejects the password. It seems to randomly deactivate my Imessage

    Try signing out and then back in again by going into Settings>Store>Apple ID:>Sign Out>

  • Getting invalid packages when installing support for stored java objects

    I am getting invalid packages notices when installing support for stored java objects in Forms 9i that can with the Oracle 9iDS Suite. In the post installation notes it says to locate a few SQL files, PLB files and a JAR file and run them. On executing the SQL package that will install the rest , I am logged in as SYSTEM as the instructions stated, I get an error when it tries to load the PLB files ( which are encrypted from Oracle). Any one else have this problem or know of a solution?
    If you need more information please let me know and I will try to respond promptly.
    Thanks
    Chad Leath

    The PLB package is called ORA_DE_REFLECTION. I forgot to mention this in the previous post.

  • Since last update (today) I get invalid password when trying to use back to my MAC, password works everywhere else

    since last update (today) I get invalid Apple ID password when trying to use back to my MAC in Icloud app on my MAC, password works on all my other devices. GLITCH ?

    Try going to the Apple ID page on your web browser
    http://www.apple.com/support/appleid/
    and try to either retrieve or reset your password
    (obviously you had to be able to successfully log in to be able to post here)
    I was finally able to log in through my system preferences after about three or four hours. I ran a disk utility to repair permissions and restarted and it seemed to work ok.

  • I try to put the program in Adobe Extension and I have an error stating extension package is invalid

    HELP!- This is the very first time I'm trying to download a plug in.  I downloaded the Adobe Extension Manager CS6.  I'm trying to install the plug in to that but I'm receiving an error stating the extension package is invalid.  Any help would be wonderful!  Thank you!

    Hi Peter,
    I cannot cut and paste , I tried it.
    Just phoned my service provider, the operator I spoke with has the same phone as mine and she said that when I am entering the codes that when I get to the + sign I should just hold it down and it will change to the + sign, but mine doesnt. Mine gives me 3 choices, 1. add new contact 2. add existing contact, 3. cancel.
    It doesnt matter how long I hold the + sign down for
    Does anyone know of a solution please, its driving me mad lol
    Thanks x

  • Package owner - invalid packages

    Hello guys,
    I have this problem: I have two DB schemes A and B. I modified the code in both schemes. After compilation, many packages were invalidated. So I compiled all invalid packages, no compilation errors, everything ok.
    Now if I run this query in scheme A:
    SELECT *
    FROM ALL_OBJECTS
    WHERE OBJECT_TYPE IN ('PACKAGE', 'PACKAGE BODY')
    AND STATUS = 'INVALID';I get two records.
    The first one shows an invalid package where owner is scheme C - this is ok, because in scheme C is really such invalid package which has granted execute to scheme A.
    The second one shows an invalid package body, where owner is scheme A. But in scheme A, there is no such package. The "invalid" package is in fact in scheme B, it is in fact not invalid and it has no grants at all. So scheme A has no access to that package at all.
    Recompilation of this package in scheme B has no impact on the result. Why is the package marked as invalid and why is scheme A assigned as an owner???
    Now I run exactly same query in scheme B and get one record.
    One package is marked as invalid where owner is scheme B. However this package is in scheme A and scheme A is the owner of this package. Again the package is not invalid and recompilation of that package has no impact... In this case the package has granted execute to scheme B, so scheme B has the access to this package.
    Can anyone help me with this?
    Thanks, Dan

    I found the problem...
    After I did those changes to that packages, I first compiled the bodies to wrong schemes. So the bodies were created without specifications. I didn't see those packages because SQL Developer doesn't display them in such case...
    So I droped them now.

  • Session is not getting invalidated when i access more then 1 war applications

              I am experiencing the following problem and i do not understand
              the reason. I have an application (3 jsps) in a directory
              called /private under weblogic 6 sp1
              directory "DefaultWebApp_myserver". The login.jsp, logout.jsp
              and logError.jsp exist in directory "DefaultWebApp_myserver"
              below is the web.xml deployed with the default web application
              ----------------------------------------- web.xml ----
              <?xml version="1.0" ?>
              <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 1.2//EN"
              "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
              <web-app>
              <welcome-file-list>
              <welcome-file>/private/checkCredentials.jsp</welcome-file>
              </welcome-file-list>
              <security-constraint>
              <web-resource-collection>
              <web-resource-name> MySecureBit0 </web-resource-name>
              <description>no description </description>
              <url-pattern>/private/*</url-pattern>
              <http-method>GET</http-method>
              <http-method>POST</http-method>
              </web-resource-collection>
              <auth-constraint>
              <role-name>NBAD_DOMAIN</role-name>
              </auth-constraint>
              </security-constraint>
              <login-config>
              <auth-method>FORM</auth-method>
              <realm-name>MyRDBMS Realm</realm-name>
              <form-login-config>
              <form-login-page>Login.jsp</form-login-page>
              <form-error-page>LoginError.jsp</form-error-page>
              </form-login-config>
              </login-config>
              </web-app>
              I have another application war. This application consist of
              2 jsp files. Below is the web.xml
              ------------------------ end web.xml -----------------------
              <?xml version="1.0" ?>
              <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 1.2//EN"
              "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
              <web-app>
              <welcome-file-list>
              <welcome-file>/private/checkCredentials.jsp</welcome-file>
              </welcome-file-list>
              <security-constraint>
              <web-resource-collection>
              <web-resource-name> MySecureBit0 </web-resource-name>
              <description>no description </description>
              <url-pattern>/*</url-pattern>
              <http-method>GET</http-method>
              <http-method>POST</http-method>
              </web-resource-collection>
              <auth-constraint>
              <role-name>Engineer</role-name>
              </auth-constraint>
              </security-constraint>
              <login-config>
              <auth-method>FORM</auth-method>
              <realm-name>MyRDBMS Realm</realm-name>
              <form-login-config>
              <form-login-page>../Login.jsp</form-login-page>
              <form-error-page>../LoginError.jsp</form-error-page>
              </form-login-config>
              </login-config>
              </web-app>
              ------------------------------ end web.xml ----------------------
              Now i login in the default application that i have i link that takes me to the
              second app (the war); then i go to the default
              app and i logout. When i logout i invalidate the session. but it
              seems that the session is not getting invalided because i can
              enter the default
              application and the war test application without login in.
              If i do not access the test war application from the default application the session
              is invalidate and i get the login page.
              I hope i am clear.
              Thanks
              Ibrahim
              

              I asked a similar question some time ago and the answer that I got was that each
              application (war file) has its own session object. You cannot transfer information
              from one application to another via the session id.
              Vladimir
              "ibrahim" <[email protected]> wrote:
              >
              >I am experiencing the following problem and i do not understand
              >the reason. I have an application (3 jsps) in a directory
              >called /private under weblogic 6 sp1
              >directory "DefaultWebApp_myserver". The login.jsp, logout.jsp
              >and logError.jsp exist in directory "DefaultWebApp_myserver"
              >below is the web.xml deployed with the default web application
              >----------------------------------------- web.xml ----
              ><?xml version="1.0" ?>
              ><!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application
              >1.2//EN"
              >"http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
              ><web-app>
              ><welcome-file-list>
              > <welcome-file>/private/checkCredentials.jsp</welcome-file>
              ></welcome-file-list>
              ><security-constraint>
              > <web-resource-collection>
              > <web-resource-name> MySecureBit0 </web-resource-name>
              > <description>no description </description>
              > <url-pattern>/private/*</url-pattern>
              > <http-method>GET</http-method>
              > <http-method>POST</http-method>
              > </web-resource-collection>
              > <auth-constraint>
              > <role-name>NBAD_DOMAIN</role-name>
              > </auth-constraint>
              ></security-constraint>
              ><login-config>
              > <auth-method>FORM</auth-method>
              > <realm-name>MyRDBMS Realm</realm-name>
              > <form-login-config>
              > <form-login-page>Login.jsp</form-login-page>
              > <form-error-page>LoginError.jsp</form-error-page>
              > </form-login-config>
              ></login-config>
              ></web-app>
              >---------------------------------------------------------
              >I have another application war. This application consist of
              >2 jsp files. Below is the web.xml
              >------------------------ end web.xml -----------------------
              >
              ><?xml version="1.0" ?>
              ><!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application
              >1.2//EN"
              >"http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
              ><web-app>
              ><welcome-file-list>
              ><welcome-file>/private/checkCredentials.jsp</welcome-file>
              ></welcome-file-list>
              ><security-constraint>
              > <web-resource-collection>
              > <web-resource-name> MySecureBit0 </web-resource-name>
              > <description>no description </description>
              > <url-pattern>/*</url-pattern>
              > <http-method>GET</http-method>
              > <http-method>POST</http-method>
              > </web-resource-collection>
              > <auth-constraint>
              > <role-name>Engineer</role-name>
              > </auth-constraint>
              ></security-constraint>
              ><login-config>
              > <auth-method>FORM</auth-method>
              > <realm-name>MyRDBMS Realm</realm-name>
              > <form-login-config>
              > <form-login-page>../Login.jsp</form-login-page>
              > <form-error-page>../LoginError.jsp</form-error-page>
              > </form-login-config>
              ></login-config>
              ></web-app>
              >------------------------------ end web.xml ----------------------
              >Now i login in the default application that i have i link that takes
              >me to the
              >second app (the war); then i go to the default
              >app and i logout. When i logout i invalidate the session. but it
              > seems that the session is not getting invalided because i can
              >enter the default
              >
              >application and the war test application without login in.
              >If i do not access the test war application from the default application
              >the session
              >is invalidate and i get the login page.
              >I hope i am clear.
              >Thanks
              >Ibrahim
              >
              

  • Valid packages goes invalid when executing application

    Friends of pl/sql
    When we execute our application we find that 2 of our main packiages go invalid for no reason. The packages compiles just fine when we then compile them. So, no syntax errors. But it stops our application with a lovely "existing state of packages have been discarded......." type error. Not too nice.
    What are some of the things to check on for why the package goes invalid ?
    We are using TOAD and sql*monitor to trace the process at the moment...........
    Any solutions out there ?
    Environment : Oracle Enterprise Linux 5 on Oracle 11.1.0.6 (latest patch available). Oracle 11 client as well.
    Edited by: ow001294 on Apr 15, 2009 9:24 AM

    One of my older standard responses (haven't use this in a while)..
    Packages tend to fail because of their "package state". A package has a "state" when it contains package level variables/constants etc. and the package is called. Upon first calling the package, the "state" is created in memory to hold the values of those variables etc. If an object that the package depends upon e.g. a table is altered in some way e.g. dropped and recreated, then because of the database dependencies, the package takes on an INVALID status. When you next make a call to the package, Oracle looks at the status and sees that it is invalid, then determines that the package has a "state". Because something has altered that the package depended upon, the state is taken as being out of date and is discarded, thus causing the "Package state has been discarded" error message.
    If a package does not have package level variables etc. i.e. the "state" then, taking the same example above, the package takes on an INVALID status, but when you next make a call to the package, Oracle sees it as Invalid, but knows that there is no "state" attached to it, and so is able to recompile the package automatically and then carry on execution without causing any error messages. The only exception here is if the thing that the package was dependant on has changes in such a way that the package cannot compile, in which case you'll get an Invalid package type of error.
    And if you want to know how to prevent discarded package states....
    Move all constants and variables into a stand-alone package spec and reference those from your initial package. Thus when the status of your original package is invlidated for whatever reason, it has no package state and can be recompiled automatically, however the package containing the vars/const will not become invalidated as it has no dependencies, so the state that is in memory for that package will remain and can continue to be used.
    As for having package level cursors, you'll need to make these local to the procedures/functions using them as you won't be able to reference cursors across packages like that (not sure about using REF CURSORS though.... there's one for me to investigate!)
    This first example shows the package state being invalided by the addition of a new column on the table, and causing it to give a "Package state discarded" error...
    SQL> set serveroutput on
    SQL>
    SQL> create table dependonme (x number)
      2  /
    Table created.
    SQL>
    SQL> insert into dependonme values (5)
      2  /
    1 row created.
    SQL>
    SQL> create or replace package mypkg is
      2    procedure myproc;
      3  end mypkg;
      4  /
    Package created.
    SQL>
    SQL> create or replace package body mypkg is
      2    v_statevar number := 5; -- this means my package has a state
      3
      4    procedure myproc is
      5      myval number;
      6    begin
      7      select x
      8      into myval
      9      from dependonme;
    10
    11      myval := myval * v_statevar;
    12      DBMS_OUTPUT.PUT_LINE('My Result is: '||myval);
    13    end;
    14  end mypkg;
    15  /
    Package body created.
    SQL>
    SQL> exec mypkg.myproc
    My Result is: 25
    PL/SQL procedure successfully completed.
    SQL>
    SQL> select object_name, object_type, status from user_objects where object_name = 'MYPKG'
      2  /
    OBJECT_NAME
    OBJECT_TYPE         STATUS
    MYPKG
    PACKAGE             VALID
    MYPKG
    PACKAGE BODY        VALID
    SQL>
    SQL>
    SQL> alter table dependonme add (y number)
      2  /
    Table altered.
    SQL>
    SQL> select object_name, object_type, status from user_objects where object_name = 'MYPKG'
      2  /
    OBJECT_NAME
    OBJECT_TYPE         STATUS
    MYPKG
    PACKAGE             VALID
    MYPKG
    PACKAGE BODY        INVALID
    SQL>
    SQL> exec mypkg.myproc
    BEGIN mypkg.myproc; END;
    ERROR at line 1:
    ORA-04068: existing state of packages has been discarded
    ORA-04061: existing state of package body "SCOTT.MYPKG" has been invalidated
    ORA-06508: PL/SQL: could not find program unit being called: "SCOTT.MYPKG"
    ORA-06512: at line 1
    SQL>
    SQL> select object_name, object_type, status from user_objects where object_name = 'MYPKG'
      2  /
    OBJECT_NAME
    OBJECT_TYPE         STATUS
    MYPKG
    PACKAGE             VALID
    MYPKG
    PACKAGE BODY        INVALID
    SQL>
    SQL> exec mypkg.myproc
    PL/SQL procedure successfully completed.
    SQL>
    SQL> select object_name, object_type, status from user_objects where object_name = 'MYPKG'
      2  /
    OBJECT_NAME
    OBJECT_TYPE         STATUS
    MYPKG
    PACKAGE             VALID
    MYPKG
    PACKAGE BODY        VALIDAnd this next example shows how having the package variables in their own package spec, allows the package to automatically recompile when it is called even though it became invalidated by the action of adding a column to the table.
    SQL> drop table dependonme
      2  /
    Table dropped.
    SQL>
    SQL> drop package mypkg
      2  /
    Package dropped.
    SQL>
    SQL> set serveroutput on
    SQL>
    SQL> create table dependonme (x number)
      2  /
    Table created.
    SQL>
    SQL> insert into dependonme values (5)
      2  /
    1 row created.
    SQL>
    SQL> create or replace package mypkg is
      2    procedure myproc;
      3  end mypkg;
      4  /
    Package created.
    SQL>
    SQL> create or replace package mypkg_state is
      2    v_statevar number := 5; -- package state in seperate package spec
      3  end mypkg_state;
      4  /
    Package created.
    SQL>
    SQL> create or replace package body mypkg is
      2    -- this package has no state area
      3
      4    procedure myproc is
      5      myval number;
      6    begin
      7      select x
      8      into myval
      9      from dependonme;
    10
    11      myval := myval * mypkg_state.v_statevar;  -- note: references the mypkg_state package
    12      DBMS_OUTPUT.PUT_LINE('My Result is: '||myval);
    13    end;
    14  end mypkg;
    15  /
    Package body created.
    SQL>
    SQL> exec mypkg.myproc
    My Result is: 25
    PL/SQL procedure successfully completed.
    SQL>
    SQL> select object_name, object_type, status from user_objects where object_name = 'MYPKG'
      2  /
    OBJECT_NAME
    OBJECT_TYPE         STATUS
    MYPKG
    PACKAGE             VALID
    MYPKG
    PACKAGE BODY        VALID
    SQL>
    SQL> alter table dependonme add (y number)
      2  /
    Table altered.
    SQL>
    SQL> select object_name, object_type, status from user_objects where object_name = 'MYPKG'
      2  /
    OBJECT_NAME
    OBJECT_TYPE         STATUS
    MYPKG
    PACKAGE             VALID
    MYPKG
    PACKAGE BODY        INVALID
    SQL>
    SQL> exec mypkg.myproc
    My Result is: 25
    PL/SQL procedure successfully completed.

  • DBMS_JOB using Packaged Functions but Package goes invalid

    Is there any way to check a package while running a PL/SQL procedure to see if it's state is valid and then catch the exception?
    In my case usually just calling any function in the package 1x clears it up but the procedure in question runs as a DBMS_JOB it just keeps failing. This procedure could run often enough that Oracle will mark it as broken but I want to give it every shot at execution on time instead of having to make it wait till the next cycle.
    What I would like to do is to catch the exception for the package state being invalid and basically have it go back to the beginning of the procedure and give it another try before failing in case it is just a failure because the package has been altered.
    Is there any way to do this?

    Firstly, I'll copy/paste my standard response regarding package state going invalid as it usually helps to have an understanding of these things...
    Packages tend to fail because of their "package state". A package has a "state" when it contains package level variables/constants etc. and the package is called. Upon first calling the package, the "state" is created in memory to hold the values of those variables etc. If an object that the package depends upon e.g. a table is altered in some way e.g. dropped and recreated, then because of the database dependencies, the package takes on an INVALID status. When you next make a call to the package, Oracle looks at the status and sees that it is invalid, then determines that the package has a "state". Because something has altered that the package depended upon, the state is taken as being out of date and is discarded, thus causing the "Package state has been discarded" error message.
    If a package does not have package level variables etc. i.e. the "state" then, taking the same example above, the package takes on an INVALID status, but when you next make a call to the package, Oracle sees it as Invalid, but knows that there is no "state" attached to it, and so is able to recompile the package automatically and then carry on execution without causing any error messages. The only exception here is if the thing that the package was dependant on has changes in such a way that the package cannot compile, in which case you'll get an Invalid package type of error.
    And if you want to know how to prevent discarded package states....
    Move all constants and variables into a stand-alone package spec and reference those from your initial package. Thus when the status of your original package is invlidated for whatever reason, it has no package state and can be recompiled automatically, however the package containing the vars/const will not become invalidated as it has no dependencies, so the state that is in memory for that package will remain and can continue to be used.
    As for having package level cursors, you'll need to make these local to the procedures/functions using them as you won't be able to reference cursors across packages like that (not sure about using REF CURSORS though.... there's one for me to investigate!)
    This first example shows the package state being invalided by the addition of a new column on the table, and causing it to give a "Package state discarded" error...
    SQL> set serveroutput on
    SQL>
    SQL> create table dependonme (x number)
      2  /
    Table created.
    SQL>
    SQL> insert into dependonme values (5)
      2  /
    1 row created.
    SQL>
    SQL> create or replace package mypkg is
      2    procedure myproc;
      3  end mypkg;
      4  /
    Package created.
    SQL>
    SQL> create or replace package body mypkg is
      2    v_statevar number := 5; -- this means my package has a state
      3
      4    procedure myproc is
      5      myval number;
      6    begin
      7      select x
      8      into myval
      9      from dependonme;
    10
    11      myval := myval * v_statevar;
    12      DBMS_OUTPUT.PUT_LINE('My Result is: '||myval);
    13    end;
    14  end mypkg;
    15  /
    Package body created.
    SQL>
    SQL> exec mypkg.myproc
    My Result is: 25
    PL/SQL procedure successfully completed.
    SQL>
    SQL> select object_name, object_type, status from user_objects where object_name = 'MYPKG'
      2  /
    OBJECT_NAME
    OBJECT_TYPE         STATUS
    MYPKG
    PACKAGE             VALID
    MYPKG
    PACKAGE BODY        VALID
    SQL>
    SQL>
    SQL> alter table dependonme add (y number)
      2  /
    Table altered.
    SQL>
    SQL> select object_name, object_type, status from user_objects where object_name = 'MYPKG'
      2  /
    OBJECT_NAME
    OBJECT_TYPE         STATUS
    MYPKG
    PACKAGE             VALID
    MYPKG
    PACKAGE BODY        INVALID
    SQL>
    SQL> exec mypkg.myproc
    BEGIN mypkg.myproc; END;
    ERROR at line 1:
    ORA-04068: existing state of packages has been discarded
    ORA-04061: existing state of package body "SCOTT.MYPKG" has been invalidated
    ORA-06508: PL/SQL: could not find program unit being called: "SCOTT.MYPKG"
    ORA-06512: at line 1
    SQL>
    SQL> select object_name, object_type, status from user_objects where object_name = 'MYPKG'
      2  /
    OBJECT_NAME
    OBJECT_TYPE         STATUS
    MYPKG
    PACKAGE             VALID
    MYPKG
    PACKAGE BODY        INVALID
    SQL>
    SQL> exec mypkg.myproc
    PL/SQL procedure successfully completed.
    SQL>
    SQL> select object_name, object_type, status from user_objects where object_name = 'MYPKG'
      2  /
    OBJECT_NAME
    OBJECT_TYPE         STATUS
    MYPKG
    PACKAGE             VALID
    MYPKG
    PACKAGE BODY        VALIDAnd this next example shows how having the package variables in their own package spec, allows the package to automatically recompile when it is called even though it became invalidated by the action of adding a column to the table.
    SQL> drop table dependonme
      2  /
    Table dropped.
    SQL>
    SQL> drop package mypkg
      2  /
    Package dropped.
    SQL>
    SQL> set serveroutput on
    SQL>
    SQL> create table dependonme (x number)
      2  /
    Table created.
    SQL>
    SQL> insert into dependonme values (5)
      2  /
    1 row created.
    SQL>
    SQL> create or replace package mypkg is
      2    procedure myproc;
      3  end mypkg;
      4  /
    Package created.
    SQL>
    SQL> create or replace package mypkg_state is
      2    v_statevar number := 5; -- package state in seperate package spec
      3  end mypkg_state;
      4  /
    Package created.
    SQL>
    SQL> create or replace package body mypkg is
      2    -- this package has no state area
      3
      4    procedure myproc is
      5      myval number;
      6    begin
      7      select x
      8      into myval
      9      from dependonme;
    10
    11      myval := myval * mypkg_state.v_statevar;  -- note: references the mypkg_state package
    12      DBMS_OUTPUT.PUT_LINE('My Result is: '||myval);
    13    end;
    14  end mypkg;
    15  /
    Package body created.
    SQL>
    SQL> exec mypkg.myproc
    My Result is: 25
    PL/SQL procedure successfully completed.
    SQL>
    SQL> select object_name, object_type, status from user_objects where object_name = 'MYPKG'
      2  /
    OBJECT_NAME
    OBJECT_TYPE         STATUS
    MYPKG
    PACKAGE             VALID
    MYPKG
    PACKAGE BODY        VALID
    SQL>
    SQL> alter table dependonme add (y number)
      2  /
    Table altered.
    SQL>
    SQL> select object_name, object_type, status from user_objects where object_name = 'MYPKG'
      2  /
    OBJECT_NAME
    OBJECT_TYPE         STATUS
    MYPKG
    PACKAGE             VALID
    MYPKG
    PACKAGE BODY        INVALID
    SQL>
    SQL> exec mypkg.myproc
    My Result is: 25
    PL/SQL procedure successfully completed.---------------------------------------------------------------------------------------------
    Secondly, from this above standard response, you can see how to check for package state if you want to determine it programatically.
    ;)

  • Hi - When I go into Contacts and type a letter in the search bar to get to last names that begin with that letter I get a list of random names that don't correlate to the letter. My settings are fine.  Help ?

    Hi. When I go into my contacts and type a letter in the saerch bar to get to a list of last names that begin with that letter I get a list of random names that don't begin or end with the letter.  My Settings appear fine.  Any insights would be greatly appreciated.  Cheers Bill

    The search bar is not designed to take you to names beginning with the letter you put in. If you want to do that, use the letters down the side. In the search bar, the device will return results for all contacts that have that have that letter in them. If you type a couple of letters of the name, you'll find what you want faster. Once you get used to how it works, it's quite efficient.
    Best of luck.

  • Problem connecting wirelessly from iMac to NETGEAR router, get invalid password message with WPA and WPA-2 encryption in place but if I remove them, so no security, can connect without a problem. Help!!

    Problem connecting wirelessly from iMac to NETGEAR router, get invalid password message with WPA and WPA-2 encryption in place but if I remove them, so no security, can connect without a problem. Help!!

    Thank you for your suggestion but I have already had a couple of phone sessions with NETGEAR support and they don't see any problems with the router settings etc. They referred me to Apple support, who helped me discover that it is possible to communicate with the router but only if I turn off the encryption/security software, which I don't want to do. The frustrating thing is that I can connect wirelessly from a laptop running Windows 7 and two Anroid smart phones, with WPA-2 in place, without a problem. Do you have any other ideas?

Maybe you are looking for

  • Dropbox syncing to wrong folder

    I have a dropbox account which syncs all my uploaded data to the Dropbox Folder in my home directory. However, recently I had changed the name of my home directory and dropbox syncs my uploaded data into the folder on the old home directory rather th

  • Performance

    Hi gurus, I got some performance related doubts. 1. In a "select" statement if I change the order of columns will it lower the performance ? eg: select posnr vbeln matnr from vbap... 2. How much percentage of performance will be suffering if I use "i

  • Applescript help with true or false script

    I'm in need of a applescript that will run two different scripts based on the outcome of an existing file. I have a folder called Status. Inside this folder is a simple text file called Good.rtf I would like a script that would run one or the other s

  • IPhone 5C 'no service' - is it worth taking it in for repair?

    I made the mistake of getting an iPhone 5C in February, mistake because this phone is obviously a lemon based on the amount of people who are having the "no service" problem with it. Even though I am in a strong signal area, I cannot reliably connect

  • Windows explorer 8 not detecting my phone

    Hi, I'm trying to install a few apps from the blackberry.com website but am unable. If I use internet explorer, it doesn't detect my phone even tho it is connected. I tried google chrome, it detects my phone but keeps on asking me to update my app wo