Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Grant select on recently created objects

user545194Mar 14 2024 — edited Mar 14 2024

Env. 19cSE2

We need to add privileges to a role for recently created objects (i.e. tables and views) on a daily basis.

select distinct o.owner
              , o.object_name
from sys.all_objects o
join dba_tab_privs d
on o.owner = d.owner
where o.owner in('SCHEMA1', 'SCHEMA2')
      and o.object_type in('TABLE', 'VIEW')
      and o.status = 'VALID'
      and o.object_name <> d.table_name
      and o.created between sysdate - 7 and sysdate -- better date range? Will probably have gaps
               -- and o.created = sysdate -- or better current date? With a scheduled job checking several times per day              

Thanks!

This post has been answered by Barbara Boehmer on Mar 16 2024
Jump to Answer
Comments
Post Details
Added on Mar 14 2024
10 comments
388 views