PL/SQL: Retrieve names of procedures and functions within a package

Adam Paynter picture Adam Paynter · Jun 29, 2009 · Viewed 10.1k times · Source

Is it possible to retrieve the names of all procedures and functions that reside within a particular package? I understand that they can be gleaned (smells hack-ish) from the ALL_SOURCE view, but I would prefer a more canonical strategy.

Answer

Justin Cave picture Justin Cave · Jun 29, 2009

DBA_PROCEDURES has the public methods within a package

SELECT owner, 
       object_name AS package_name, 
       procedure_name AS method_name
  FROM dba_procedures
 WHERE object_type = 'PACKAGE'

If you also want private methods, that information is not directly accessible in the data dictionary. In that case, you'd need to parse the source (which would obviously be rather painful, particularly if you happen to have nested private methods within public or private methods in the package).