I'll wager that you have privileges on dba_tab_privs
via a role, not via a direct grant. If you want to use a definer's rights stored function, the owner of the function has to have privileges on all the objects granted directly, not via a role.
If you disable roles in your interactive session, can you still query dba_tab_privs
? That is, if you do
SQL> set role none;
SQL> select * from dba_tab_privs
do you get the same ORA-00942 error? Assuming that you do
GRANT select any dictionary
TO procedure_owner
will give the procedure_owner
user the ability to query any data dictionary table in a stored function. Of course, you could also do a direct grant on just dba_tab_privs
.