I have an issue executing this same procedure multiple times.
Right after compilation it works fine. When I execute the same procedure second time I gets the following error message:
ORA-04068: existing state of packages has been discarded
ORA-04061: existing state of package body "scott.REC" has been invalidated
ORA-06508: PL/SQL: could not find program unit being called
ORA-06512: at line 5
If I run it third time (not doing anything) or explicitly recompiling it again it works. If I run it fourth time I gets the same error message from above. It seems that I have to recompile this procedure explicitly every time to avoid a system error. What could be wrong with this procedure?