How can I check if a procedure exists in a package?

You should be able to obtain this information from the DBA_PROCEDURES view:

SELECT *
  FROM SYS.DBA_PROCEDURES
  WHERE OBJECT_TYPE = 'PACKAGE' AND
        OBJECT_NAME = '<your package name>' AND
        PROCEDURE_NAME = '<your procedure name>'

If this returns a row the procedure you're interested in exists in the package. If you get a NO_DATA_FOUND exception it means the procedure doesn't exist in the package.

Share and enjoy.


Doesn't the user that is querying SYS.DBA_PROCEDURES need special privileges? Maybe querying SYS.User_Objects requires less permissions?

select * from SYS.User_Objects where object_type = 'PACKAGE';

Tags:

Oracle

Plsql