ORA-04068: existing state of packages has been discarded
I work with Oracle on a daily basis, and if there's one "feature" I really hate, it's their dependency system.
The logic is ok to some extent, in that if I drop an object (procedure, table etc) that some other procedure depends on, this procedure gets invalidated because it won't work when the objects it depends on are different/gone. However, this happens even when a procedure is altered (signature intact), making room for many interesting scenarios.
Oracle tries to fix this by introducing packages. As long as the package specification is intact (declaration of the procedures and functions within the package), you can alter the package body without affecting dependent objects. Which is fine, except...
If you recompile the body, the next session using the package will get the "ORA-04068: existing state of packages has been discarded". WTF??. As you can guess, this may mess up a LOT. And to make it even worse, sometimes the error won't go away. I really hate this. At Oracle's own admin course I asked the teacher about this, to which he replied "I have no idea, I didn't know this".
Seriously, PL/SQL is nice and wonderful and makes a lot of stuff a lot easier, but this error kills me. Why, why, why? Can I turn it off? I've never seen a way! Why do they have it there??
There's a reason i use Postgres on all personal projects. Seriously. One of the marvels about stored procedures is the ability to redeploy without a fuss, not cause unnecesary chain invalidations. I DON'T NEED THIS.
If you've experienced the same, please share your pain. I know I have plenty.
This only happens when you have package-scoped variable in your package.
I still don't see the point in packages. Or "recordset returning procedures" -- I though returning values was hat functions were for.