code_junkie

Grant Select on all Tables Owned By Specific User

Nov 11th, 2011
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. Grant Select on OwningUser.* to ReceivingUser
  2.  
  3. Select 'GRANT SELECT ON OwningUser.'||Table_Name||'TO ReceivingUser'
  4. From All_Tables Where Owner='OWNINGUSER'
  5.  
  6. BEGIN
  7. FOR R IN (SELECT owner, table_name FROM all_tables WHERE owner='TheOwner') LOOP
  8. EXECUTE IMMEDIATE 'grant select on '||R.owner||'.'||R.table_name||' to TheUser';
  9. END LOOP;
  10. END;
Add Comment
Please, Sign In to add comment