Why do packages go invalid ?

Hi,
Whenever I do a DDL to a table or re-create existing functions, dependent packages/ functions go invalid.
Is there a reason for this? 
Thanks!
Anand       

Yes all dependent objects will go to invalid state and oracle will autocomplie when they will get accessed. OR you need to compile all or manually compile selected objects.
You can find dependencies from below query for the modified objects.
select * from DBA_DEPENDENCIES
where owner = 'PROVIDE SCHEMA_NAME'
and name = 'PROVIDE OBJECT_NAME'

Similar Messages

  • 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.

  • 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.

  • 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

  • How to resolve a "The Extension Package is invalid."error  message in Adobe Extension Manager CS5,6

    How to resolve a "The Extension Package is invalid.error message in Adobe Extension Manager CS5,6

    I'm using Windows XP Professional sp3.I've tried to install(unfortunately,to no effect,till now)Layers Control by Vadim Chtcherbakov ,Floating Adj by David Barranca,Photoshop Blending Modes by Rufus Deuchler,and The Fader by Capture Monkey.The  Adobe Extension Managers I have installed in my PC are 5.0.1 for CS5,and 6.0.8 for CS6...Thanks in advance for your consultation!

  • 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

  • The extension package is invalid

    The extension package is invalid. The extension will not be
    installed.
    When attempting to download and install extensions from the
    Dreamweaver extensions listed at the Adobe Dreamweaver Extension
    page I receive this message.
    Any solution?
    I am running Dreamweaver 8 on a PC. The OS is Vista. Don't
    tell me Vista is at fault. It will occasionally install an
    extension just fine. Most of the time it won't.

    What extension? Have you checked the specs to see if your OS
    is supported?
    > I am running Dreamweaver 8 on a PC. The OS is Vista.
    Don't tell me Vista
    > is
    > at fault. It will occasionally install an extension just
    fine. Most of
    > the
    > time it won't.
    >
    Occasionally? I think you have your answer. Dreamweaver 8
    came out a year
    before Vista did. Many of the extensions on the Exchange may
    not even
    support 8 .. many of them do. Make sure 8 is supported in the
    extensions
    you are trying to install. As for Vista .. I don't have it so
    it's hard for
    me to comment. I have seen enough however that I'll probably
    wait at least
    a year and let them put out a better version before I take
    that plunge.
    JMO.
    Nancy Gill
    Adobe Community Expert
    Author: Dreamweaver 8 e-book for the DMX Zone
    Co-Author: Dreamweaver MX: Instant Troubleshooter (August,
    2003)
    Technical Editor: DMX 2004: The Complete Reference, DMX 2004:
    A Beginner''s
    Guide, Mastering Macromedia Contribute
    Technical Reviewer: Dynamic Dreamweaver MX/DMX: Advanced PHP
    Web Development

  • Why do we get invalids in EBS

    why do we get invalids in EBS database (db 10g and R12 EBS) i mean what kind of scenarios we will get invalids, can you please explain me in detail.

    Please see these docs/links.
    Invalid Objects In Oracle Applications FAQ [ID 104457.1]
    http://forums.oracle.com/forums/search.jspa?threadID=&q=104457.1&objID=c3&dateRange=all&userID=&numResults=15&rankBy=10001
    http://forums.oracle.com/forums/search.jspa?threadID=&q=Invalid+AND+Objects&objID=c3&dateRange=all&userID=&numResults=15&rankBy=10001
    Thanks,
    Hussein

  • 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)

  • Error message: Package contains invalid characters installing patchlevel 6

    Dear experts:
    I have successfullly installed SAP GUI 7.20 compilation 2, using SAP installation server (40 machines, Windows XP sp3 32 bits, latest updates).
    I have successfully installed patchlevel 6 in the SAP installation server. (gui720_6-10007878.exe, downloaded from SAP Portal)
    SAP GUI is configured to search for updates after 5 double-clicks on desktop icon. I forced the 5 double-clicks on a test machine and the patch begins to install; then informs me that there is a pending reboot.
    When I reboot the machine a SAP Netweaver Front-end installer window appears with the error: "/Package contains invalid characters like /*?"<>\" - "Your system has a pending reboot". If I reboot again the message is displayed again.
    If I click on the "Cancel" button of this window, Windows XP continues booting and SAP GUI works fine.
    Two questions:
    How can I avoid the installation of this patch on all the machines?
    What can be wrong?
    Thank you very much.
    Mr.Clinker
    Uruguay - South America.

    1.) To avoid the installation on all clients simply go to "Services -> Configure Automatic Workstation Update Service" in the SAP Installation Server Administration Tool and disbale the service. If this doesnt work you can delete the package on the installation server an create a new one with the same name. You can than patch the package to the patchlevel you want.
    2.) Try to apply patch 6 Hotfix 2 and see if the problem remains.

  • Extension package is invalid. The extension will not be installed

    Hi!
    Extension package is invalid. The extension will not be installed.
    This is the message i receive throughout CS (illustrator, photoshop, indesign) with all of the extensions I have downloaded. Working on PC / Win7
    Thank You!

    1. Create a file named "ExManLog.YES" in Extension Manager folder.
        Windows:
        1) Open command prompt as administrator;
        2) Change directory to "C:\Program File (x86)\Adobe\Adobe Extension Manager CS6"
        3) Run command
        echo > ExManLog.YES
        Mac:
        1) Open terminal;
        2) Change directory to"/Applications/Adobe Extension Manager CS6/Adobe Extension Manager CS6.app/Contents/MacOS";
        3) Run command
        sudo touch ExManLog.YES
    2. Launch Extension Manager.
    3. Extension Manager log files( *.log ) can be found in the following folder.
        Windows: "C:\Users\<UserName>\AppData\Roaming\Adobe\Extension Manager CS6\"
        Mac: "/Users/<UserName>/Library/Application Support/Adobe/Extension Manager CS6/"
    4.send the log files and the extension to [email protected]

  • How to find the status of package (valid/invalid) was at a particular time

    How to find the status of package (valid/invalid) was at a particular time ?
    I want to find the status of one oracle package at 3pm yesterday. The status of this package today is INVALID.
    I am sure it was VALID yesterday. But no way to prove it. Can any one help please???
    I can generate AWR report for last 7 days...

    Try using a flashback query, like this:
    select object_name, object_type, status
    from dba_objects AS OF TIMESTAMP (SYSTIMESTAMP - INTERVAL '18' HOUR)  -- 18 hours ago
    where object_name = 'MY_OBJECT'
    ;if you haven't granted FLASHBACK privs, you may need to connect as SYS to do a flashback query on a data dictionary table.
    But this should give you the info you need - if it's still in undo.

  • If "String[ ]args" is a valid syntax, why "int( )func" is invalid?

    May sound stupid but,
    If "String[ ]args" is a valid syntax, why "int( )func" is invalid ?

    I know Java creators have made String[ ]args as valid for easy understanding and readabilityThey did that to effect a major improvement over the confusing 'C' syntax. In 'C', if you haveint a[], b, c, d; (i) the 'array-ness' only applies to a; (ii) you have the datatype distributed on both sides of the variable name; (iii) you have multiple datatypes being declared in one line of code (both int and int[]). All of which Gosling (and I) found counter-intuitive. In Java if you writeString[] a,b,c;they are all arrays, and the entire datatype is on the left before any identifiers. It's a better syntax.
    but isn't this same procedure can also be followed in functions?But (a) the current syntax isn't confusing or counter-intuitive; (b) changing it wouldn't improve 'easy understanding'; and (c) multiple functions aren't declared in a single line of code anyway.
    So your question is pointless.

  • 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.
    ;)

  • HT3702 Why does it say invalid security code when I'm prompted to sign in?

    Why does it say invalid security code when I'm prompted to sign in. I have intered my security code from my credit card several times. It will not allow me to use the app store, even for free purchases.

    Is the address on your iTunes account exactly the same (format and spacing etc) as on your credit card bill : http://support.apple.com/kb/TS1646 ? If it is then you could try what it says at the bottom of that page :
    If the issue persists, contact your credit card company and verify that they and any company they use to process credit card authorizations have the correct information on file.
    And/or try contacting iTunes support : http://www.apple.com/support/itunes/contact/ - click on Express Lane, then iTunes > iTunes Store

Maybe you are looking for

  • Problem getting CF8 administrator to work on windows 2008 server

    When I create a file helloworld.cfm in root folder and browse to http://localhost/helloworld.cfm, it renders cfoutput fine <cfoutput>#now()#</cfoutput> shows the correct date and time. But, when I go to the CF Administrator and enter the password for

  • Best way in using models & Increasing performance

    Hi all, I had some doubts in creation of model objects. 1.How many RFCs can a model object can contain? 2.I had a business senario where i had to use 4 Fm for performing a task.If i craete a single model object for this 4 Fun modules.Will it increase

  • HT201210 the error 1015 persist i can't restore my iphone,what can i do ?

    i was restoring my iphone3 (4.1) to (4.2) but at the end i get a restore error 1015 ,what can i do to resolve it?

  • Problem to authenticate MAC address on ISE

    Hi guys, I have a Lab with a ISE ver 1.1.1 installed on VMWARE, a Switch 3750, a WLC 4200 and one AP registered on WLC, the WLC and AP are connected to Switch, we are testing the user authentication using a samsung tablet and it work ok. The authenti

  • System status icon

    Hi Experts, I need to disable system status icon: header and item in CRMD_ORDER, for few users, I have no idea how to do this Appreciate your help on this.. Regards Beginner