Grant Select on all Tables Owned By Specific User

Well, it’s not a single statement, but it’s about as close as you can get with oracle:

BEGIN
   FOR R IN (SELECT owner, table_name FROM all_tables WHERE owner="TheOwner") LOOP
      EXECUTE IMMEDIATE 'grant select on '||R.owner||'.'||R.table_name||' to TheUser';
   END LOOP;
END; 

Leave a Comment