A package is considered invalid from another package when it isn't

Hi all,
I have two packages, A and B. I have unit test for both packages. B uses some procedures from A. After they are compiled (A first, then B), when I run the unit test for B in sqlplus, I get
ORA-04068: existing state of packages has been discarded
ORA-04065: not executed, altered or dropped stored procedure "my_schema.A"
ORA-06508: PL/SQL: could not find program unit being called
ORA-06512: at "my_schema.B", line 886
ORA-06512: at line 6
But if I run the unit test for A, it works perfectly (so I think A has been compiled correctly and could be found in the database).
For those who have read my post yesterday titled 'existing state of packages has been discarded', this is the same problem. Sorry for posting twice but I really need to get this working.
Thanks.
Gloria Chung

This shouldn't be a problem if you are running the unit tests in the same session as you are recompiling the packages.
Basically, package A must be storing values in package level variables. Like this...
SQL1> CREATE OR REPLACE PACKAGE ap AS
2 FUNCTION f RETURN number;
3 END;
4 /
Package created.
SQL1> CREATE OR REPLACE PACKAGE BODY ap AS
2 FUNCTION f RETURN number IS
3 BEGIN
4 RETURN 2;
5 END;
6 END;
7 /
Package body created.
SQL1> CREATE OR REPLACE PACKAGE bp AS
2 FUNCTION f RETURN NUMBER;
3 END;
4 /
Package created.
SQL1> CREATE OR REPLACE PACKAGE BODY bp AS
2 n NUMBER;
3 FUNCTION f RETURN NUMBER IS
4 BEGIN
5 n := n + ap.f;
6 RETURN n;
7 END;
8 BEGIN
9 n := 0;
10 END;
11 /
Package body created.
SQL1>
Now we can use that in another session...
SQL2> var x number
SQL2> exec :x := bp.f
PL/SQL procedure successfully completed.
SQL2> print x
         X
         2
SQL2>So far so good. Now in the first session we run ...
SQL1> CREATE OR REPLACE PACKAGE BODY bp AS
  2    n NUMBER;
  3    FUNCTION f RETURN NUMBER IS
  4    BEGIN
  5       n := n * ap.f;
  6       RETURN n;
  7    END;
  8  BEGIN
  9      n := 4;
10  END;
11  /
Package body created.
SQL1> back in session two...
SQL2> exec :x := bp.f
BEGIN :x := bp.f; END;
ERROR at line 1:
ORA-04068: existing state of packages has been discarded
ORA-04061: existing state of package body "APC.BP" has been invalidated
ORA-04065: not executed, altered or dropped package body "APC.BP"
ORA-06508: PL/SQL: could not find program unit being called
ORA-06512: at line 1
SQL2>aaargh! disaster! But all we have to do is ...
SQL2> conn apc/apc
Connected.
SQL2> var x number
SQL2> exec :x := bp.f
PL/SQL procedure successfully completed.
SQL2> print x
         X
         8
SQL2> I'm not saying its satisfactory, because obviously it isn't. But I don't see what else Oracle can do.
Cheers, APC

Similar Messages

  • Instantiating a class from another package

    Hi,
    I have two packages, say "framework" and "impl" -
    framework package (framework.jar)
    - contains base classes
    - contains factories to instantiate concrete classes
    - bundled in <product>.ear
    impl package (impl.jar)
    - contains implementation(concrete) classes
    - compile time dependency on framework.jar
    - bundled in <product>.ear
    I could successfully compiled and build <product>.ear which contains both the jars. The ear gets deployed successfully.
    PROBLEM
    Now, whenever a factory class (part of framework package) tries to instantitate an impl class (part of impl package) using -
    Class.forName(impl.ConcreteClassName OR fully_qualified_concrete_class_name).newInstance();
    It throws "classNotFoundException". It is not able to locate the concrete class.
    So, my question is how can i instantiate a class using its fully qualified name(package.classname) from another package ?
    Thanks.

    909219 wrote:
    PROBLEM
    Now, whenever a factory class (part of framework package) tries to instantitate an impl class (part of impl package) using -
    Class.forName(impl.ConcreteClassName OR fully_qualified_concrete_class_name).newInstance();
    It throws "classNotFoundException". It is not able to locate the concrete class.This sound like a classpath problem. Check your ear's manifest.
    BTW:
    Shouldn't the framework better use ServiceRegistry to load implementations?
    bye
    TPD

  • Calling package from another package

    Hi gurus,
    Quick question
    Say i m in user1 schema.
    I want to call package from another package in the same schema. So do i need to grant permission to the calling package to call.Thank you!!

    Why don't you test it?
    create or replace package pack2
    is
      procedure t2;
    end;
    Package created.
    create or replace package body pack2
    is
      procedure t2
      is
      begin
       dbms_output.put_line('Inside Pack2 And t2');
      end;
    end;
    Package Body created.
    create or replace package pack1
    is
      procedure t1;
    end;
    Package created.
    create or replace package body pack1
    is
      procedure t1
      is
      begin
        pack2.t2;
        dbms_output.put_line('Inside Pack1 And t1');
      end;
    end;
    Package Body created.
    begin
    pack1.t1;
    end;
    Inside Pack2 And t2
    Inside Pack1 And t1
    Statement processed.
    0.11 secondsRegards.
    Satyaki De

  • How do I improve package loading performance in BIDS when I open a package which is imported from another place?

    [This is just for sharing information for those common asked questions collected from forums. If you have any better way or feedback, please directly reply in this thread so that community users can benefit from your answers.]
    Question:
    I have a SSIS package which has some execution problem in production environment and I need to check it and perform debugging on my local machine, however when I add the package into my SSIS project and open it in BIDS, my BIDS hangs for a long time.
    Answer:
    This issue is usually caused by the fact that your SSIS package is complex with many tasks including many connection managers. When you open the SSIS package in BIDS, by default the validation process on each task will start. Since your SSIS package is copied
    from another place, the connections may be invalid. In this case, the validation process will spend a lot of time and cause the BIDS not working during this time.
    To resolve this issue, you can do as follows:
    1.Before you add the SSIS package, select your SSIS project first, then click the SSIS menu, and change your SSIS project to Offline mode by checking "Work Offline".
    2.Add your SSIS package to the project and change each Task's DelayValidation property to True.
    3.After these steps, you can modify the connections to be valid based on your local test environment.
    Please remember to mark the replies as answers if they help and unmark them if they provide no help

    Hello Charles,
    My workmate am so happy to hear this solution I told him. Really thanks for your detail solution.
    Best regards,
    Challen Fu
    Challen Fu
    TechNet Community Support

  • Executing another class from another package with a click of a button

    package language;
    textfield_4 = new JTextField();
    getContentPane().add(textfield_4);
    button_10 = new JButton("Open");
        getContentPane().add(button_10);
        button_10.addActionListener(new java.awt.event.ActionListener()
          public void actionPerformed(ActionEvent e)
            String cmd = "notepad.exe";
            String path = textfield_4.getText();
            try
              Runtime.getRuntime().exec(cmd + " \"" + path + "\"");
            catch (IOException ex)
              ex.printStackTrace();
        button_12 = new JButton("Run");
        getContentPane().add(button_12);From the codes above, what i intended to do is when clicking the "Run" button, it will pass the values from textfield_4 to another class in another package thus, executing the class with the value of textfield_4. What are the steps to do that? If possible, please insert sample codes. Thank you.

    import  anyPackage.AnotherClass;
    button_12.addActionListener(new ActionListener() {
      AnotherClass ac = new AnotherClass();
      ac.execute(textfield_4.getText());
    });Is that what you wanted?

  • Can I use a sim from another carrier when traveling overseas?

    Can I use a sim from another carrier while in Europe or Canada to enjoy local rates and avoid roaming charges?

    If your phone is officially unlocked, yes. Otherwise, no.

  • How to access constructor that is not public from another package

    Hi,
    We have a class that has a constructor in package se.company.internal that looks like:
    DraHw(){
    Then from a HwTest class ( packge se.company.function.hw) we want to access this class but we cannot make the constructor public.
    Any ideas on how we can create an instance of DraHw when testing without making constructor public?
    br,
    //mike

    > we want
    However do you in fact actually need to?  And if you do that are you breaking the design of the other app?  Obviously there is in fact a way to create the class so perhaps you should study that first to insure that there is not some designed way to do what you want.
    > How would that 1:1 one class look like?
    I REALLY suggest that you look at the original design again.

  • How do approve from another device when I changed my number

    I recently got an iPad air 2. I would like to approve my new device to use my Apple ID. We authorization process requires receiving a text message from my old cell phone number that I no longer have access to. How do I have proof the device sent my phone number has changed?
    thank you for your time helping me

    My guess is that you have set up two-step verification for your Apple ID:
    iCloud: two-step verification
    So I suspect your old iPhone number was one of the devices set up to receive an authorization request.
    Note that you could also use your recovery key (instead of your iPhone) if this is the case.

  • How a to call a form from another form when the button is pressed

    Hi All
    I working with oracle apps r12
    I have develop a new form and attached into a special menu here i have two button
    When i click a button i need to call my new form.
    I have tried so far is
    I have write a trigger in that button when button pressed
    open_form('Form_name',Activate)
    regards
    Srikkanth
    Edited by: Srikkanth.M on Aug 18, 2011 7:06 PM

    Can you not use zoom functionality ?
    How to Zoom or Create Master-Details relationship Using Forms Personalization? (Doc ID 457643.1)
    HTH
    Srini

  • A package that "patches" another package

    I'd like to make a PKGBUILD for usb-rndis-lite v0.11. Usb-rndis-lite contains files that should replace some files from 'kernel26' package. Is it right when one package replaces files from another package? If so, what is the right way to do that?
    The point is that USB RNDIS driver, included in current 2.6.26 kernel is either outdated or buggy, so sometimes it needs to be replaced by SynCE's usb-rndis-lite. Unfortunately that driver is a part of kernel26 package and cannot be separately removed.

    Mr.Cat wrote:Nothing would prevent me from doing this, but that would be the "wrong way", I suppose. And you've mentioned one of the reasons - possible problems with correct package removal. Another problem I see - is that when kernel26 is updated - my package's files would be owerwritten.
    Exactly. Pretty ugly solution, although possible. In the install script, you can specify an uninstall function, so theoretically you can backup the original driver on install, and restore on uninstall, with a check if it hasn't been updated meanwhile.
    UPD:
    bender02 wrote:There's a special directory where you can put your patched/updated version of a driver, and then modprobe/insmod would load that new version, when the driver is requested.
    Thanks, worked for me.
    UPD:
    I've submitted a PKGBUILD for rndis-usb-lite (v0.11) to unsupported: http://aur.archlinux.org/packages.php?ID=20336.
    I'm glad it worked.

  • NetBeans: Calling code from other packages?

    Normally, when I would call code from eclipse, I would type something like:
    import +<package name>.<class name>+But somehow, this approach doesn't seem to work in NetBeans, how can I import code from another package? I can seem to import from the same package, but not a different one.
    Edited by: px7659 on Jun 15, 2010 6:21 PM

    px7659 wrote:
    Normally, when I would call code from eclipse, I would type something like:
    import +<package name>.<class name>+But somehow, this approach doesn't seem to work in NetBeans, how can I import code from another package? I can seem to import from the same package, but not a different one.Then the package is not part of the project. Did you perhaps forget to add the jar library in question?

  • Loading fails, when classes from other packages are referenced

    My applet follows a simple package structure.
    There's package P1 and there's another package in it P2 (P1.P2)
    P1 contains Applet class A.
    P2 contains another class C and interface I. C implements I.
    A contains a reference of C, which is initialized in the constructor. The use in the constructor of the A (the applet) is something like this
    public A () {
              reg = ToolkitRegistry.getEntry (); //where reg is a reference of type ToolkitRegistry.
              // some more code
              i = (I) C.getC (); //where i is a reference of type I.
    }Trying to load this applet throws error saying "Package Loading failed". Important is to note that the loading occurs successfully by commenting out this line           i = (I) C.getC (); //where i is a reference of type I. , without any other change.
    I understood this to be some problem with the AIDs assigned to both the packages while converting. Unsure of what's the correct way to assign the PIX values, I've been trying some permutation/combinations, it doesn't seem to work.
    Has neone already faced this problem & knows the solution? (The specs aren't much help)

    One more point ..... I mentioned commenting the statements, I DO NOT commment the other statements referencing the other package. This means that the loading IS succesfull, even when these two lines reside in there.
    1. import P1.P2.*; 2. private I i = null;Above two lines pass the loader. The object creation gets stuck.
    Wonder if the package references are actually alright, because JVM wud've treated both situations in a similar way. JCVM is ofcourse different but JCVM spec does not say nething abt this situation (rem: everything is public, so the access control restrictions also do not apply)
    are there ne instantiation restrictions? [In my case, it's in the constructor thread)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Unable to open 10g Database Control Webpage from another computer

    Unable to open 10g Database Control Webpage from another computer
    Hi Gurus
    I have just installed Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 on my PC Windows XP , created database and configured DB control
    I can open Database Control Webpage on the database machine by typing
    http://USI2374993VND0.vlgdw2k.visteon.com:1158/em
    or
    http://136.18.70.189:1158/em
    But can not open it from another PC
    When I do following from another PC
    1. http://USI2374993VND0.vlgdw2k.visteon.com:1158/em
    Get error: [code=DNS_NO_DATA] The IP address was not found during the DNS lookup. Contact your system administrator.
    2. http://136.18.70.189:1158/em
    Get error:Can not display web page
    I can ping 136.18.70.189 but not USI2374993VND0.vlgdw2k.visteon.com
    On the other PC I also tried adding 136.18.70.189 to
    tools - internet options - security - local internet - sites - advanced - add this web
    site to the zone as http://136.18.70.189
    But it did not work
    Please help with any ideas
    Thanks a bunch
    New DBA

    Firewalls?
    DNS translation issues?

  • Multi-room DVR not deleting recording after it was watched from another room.

    DVR records and deletes any program fine - as long as it was watched from the DVR.
    I try and delete a recording that was watched from another box and it errors with a message similar to "recording is being watched from another box."
    I have to wait about a week or two to delete. We're now placing bets as to what the magical day will be when we can delete a specific recording.
    Upgraded 2 weeks ago from the old silver DVR to a new black DVR. I was positive the new DVR would resolve the issue - wrong.
    I read in: http://forums.verizon.com/t5/FiOS-TV-Technical-Assistance/Can-t-delete-shows-off-of-DVR/td-p/428933 that if I watch another recording, I'll be able to delete the first recording - will try that tonight.
    Still, even if that works, it's still irritating. Any ideas?

    Mangor wrote:
    DVR records and deletes any program fine - as long as it was watched from the DVR.
    I try and delete a recording that was watched from another box and it errors with a message similar to "recording is being watched from another box."
    TO delete a recording from another box when you are done you must either let the recording complete and move you bck to live TV, or, easier, when you click on the particular show you are watching first click on "Stop the Recording" or whateversimilar to that it says that means STOP.  Once the recording stops, then click on the show again and click on "delete"
    Works for me. In other words you can't delete a show on another DVR until you first stop it.
       starrin

  • Xcelsius and relative cell in Excel from another document

    Hi, gurus.
    I have one question about Xcelsius opportunities. Can I use relative cells in Excel document, which as links to cell in another excel document. For example I have two Excel document. At first I use relative cell like this "='\job\[test_1.xlsx]List1'!$C$6",  after them I imported file with  this link to Xcelsius and I can see value from another document, when I work with Xcelsius only. When I view my result or exported in swf - I see that this value become 0, like empty cell.
    Can I use relative cells in Xcelsius or it is them  limitation?
    Thanks in advance, Ruslan.
    Edited by: Ruslan Latypov on Aug 10, 2011 11:15 AM

    Thank you. I think so too. But I have no confirmation...
    And I think this limit like limit for work with Excel  Macros,  because If we  may use macros in another document, with work opportunity with relative cells we can get data with VBA scripts computing.

Maybe you are looking for