I have an oracle procedure which calls few other procedures.
PROCEDURE1
PROCEDURE2
PROCEDURE3
..
Now what happens is that PROCEDURE2 is performing DDL (EXECUTE IMMEDIATE 'DDL PROCESS' ) on some dependent tables being used in subsequent procedures 3 and onwards. This runs fine until it hits PROCEDURE3 where it throws ORA-06508 - Program / Unit being called not found.
We can not modify it not to use DDL, We have to use them. I have tried recompiling after DDL statements but it does not work (ALTER PROCEDURE PROCEDURE3 RECOMPILE) neither in PROCEDURE1 or in PROCEDURE2.
I doubt that PROCEDURE1 itself becomes invalid and compiling that on runtime will cause endless loop. I have tried, does not works.
So I need to use some trick that can make these procedures valid again on runtime after DDL is done on dependent objects.
Thanks in advance for whoever participates to answer.
In this case, as in many other cases, would be better to create a package instead of a bunch of stand-alone procedures. Packages break dependency chain. Here is an example:
Stand-alone procedures
Procedure created
and we are getting
Package