views:

624

answers:

1

I need to find out which schemata have already been granted execute permission on a certain object in an Oracle 10g db (in this case, a package). What's the simplest way for me to do this? Is there a built-in function to provide this information?

+3  A: 
SELECT grantee
  FROM all_tab_privs
 WHERE table_name = '<your object name>'
  AND privilege = 'EXECUTE'
  AND grantor = '<object owner>';

Yeah, I know, it says "table_name" but it applies to executable objects as well. The table DBA_TAB_PRIVS works as well. You'll need appropriate permissions (e.g., DBA role, SELECT ANY TALBE) to select from these views and see all the data.

In response to Martin's comment... The above is the easiest way to do what you asked for that I know of. If you want to limit it to packages, try this:

SELECT * FROM all_tab_privs JOIN all_objects ON (table_name = object_name)
 WHERE table_name = '<your object name>'
   AND object_type = 'PACKAGE'
   AND privilege = 'EXECUTE'
   AND grantor = '<object owner>';
DCookie
I was actually after either something more general, or a package specific case...
MPritch
All is forgiven! Good old oracle and its no-nonsense naming of system tables :)
MPritch