Through Oracle queries is it possible to find out which views/synonyms/tables a stored procedure use?
In PL/SQL Developer if you collapse out a stored procedure it will show "References" which shows all the tables/views/synonyms that the stored procedure uses.
I am trying to implement this functionality into a script which will come in handy.
Wondering if anyone knows a script that will fetch me all the synonyms/views/tables that a stored procedure uses?
The answer by @Rene is correct however I believe it needs additional explanation. When selecting from
all_dependencies
you might run query like one below that should give you all the objects that are referencing your SP.You might be surprised when it will come back empty-handed.
This is because oracle is CASE SENSITIVE. What this means is that you have to ether disable case sensitivity (if version of oracle you are using is above 10g r2)
or
upper
both sides when comparingHope this saves you some time and frustration.
The information you are looking for is in the user_dependencies/all_dependencies view.