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!

Granting select access on all tables of a schema to another schema

996283May 13 2013 — edited May 13 2013
Hi all,

I can grant select access on tables of a schema (SAY USER1) to another (SAY USER2) by granting it to a role and in turn grant that role to another schema as below:

FOR x IN (SELECT * FROM user_tables)
LOOP
EXECUTE IMMEDIATE 'GRANT SELECT ON ' || x.table_name || ' TO <<role1>>';
END LOOP;

Grant role1 to user2;

but my doubt is that suppose i am creating another table say 'TEMP_TAB' in USER1 schema after executing the above block, shall user2 will be able to access TEMP_TAB table. My guess is definitely not. If i am correct, i want a way to grant select on a table in user1 schema immediately as and when it is created to user2.

please suggest a solution.

Thanks & Regards,
Vipin Kumar Rai
This post has been answered by Karthick2003 on May 13 2013
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 10 2013
Added on May 13 2013
6 comments
10,389 views