I want to obtain a list with all private procedures/functions from a package body.
For public object it is easy but I have no idea how to do that for private objects.
I want to obtain a list with all private procedures/functions from a package body.
For public object it is easy but I have no idea how to do that for private objects.
The nature of private functions is that they are private. There are no data dictionary views which expose them by default. USER_PROCEDURES and USER_ARGUMENTS only show information for public procedures (the ones defined in a package spec0.
However, we can get information about them using PL/SCOPE, but doing so requires a little bit of additional effort:
SQL> alter session set plscope_settings='IDENTIFIERS:ALL';
SQL> alter package your_package compile body;
Now you can find your private program units with this query:
To get the arguments of a private procedure plug the USAGE_ID from the previous query into this query:
This needs to be a left join because
user_identifiers
has datatype entries for scalar datatypes (character, number, date, clob) but not complex datatypes (xmltype, user-defined types).We can get lots of information about procedures from PL/SCOPE, even though it is not as easy as querying USER_PROCEDURES or USER_ARGUMENTS (in fact, it is surprisingly clunky). Find out more. Be aware that PL/SCOPE data is stored on the SYSAUX tablespace, so don't get into hot water with your DBA!