Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Oracle database dependencies in PL/SQL

I need to find dependencies between functions/procedures(defined inside package bodies) and tables which they use.

I've tried all_dependencies but it works only on the package-level, not the inner function/procedure-level. Is there any possibilty to find this dependencies using e.g. all_source?

Thanks in advance for your help.

like image 528
pcejrowski Avatar asked May 05 '26 10:05

pcejrowski


1 Answers

It is not possible to find the dependencies between procedures (in a package) and tables.

There are several tools to examine dependencies. As you've already discovered, *_DEPENDENCIES only tracks object dependencies on a per-package level. There is a neat tool PL/Scope that tracks dependencies between parts of a package. But it does it does not track all table references.

Theoretically you could use *_SOURCE. In practice, this is impossible unless your code uses a limited set of features. For any moderately complicated code, forget about using string functions or regular expressions to parse code. Unfortunately there does not seem to be any PL/SQL parser that is both programmable and capable of accurately parsing complex code.

Saying "it's not possible" isn't a great answer. But in this case it might save you a lot of time. This is one of those tasks where it's very easy to hit a dead end and waste a lot of effort.

like image 58
Jon Heller Avatar answered May 08 '26 04:05

Jon Heller



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!