Thursday, September 18, 2014

grant permissions on all tables to a user

Grant select  permission on all tables in logged in schema to a user/role:



declare
cursor c1 is select table_name from user_tables;
cmd varchar2(200);
begin
for c in c1 loop
cmd := 'GRANT SELECT ON '||c.table_name||' TO &&YOURUSERNAME';
execute immediate cmd;
end loop;
end;



Note :
you change the select to what ever permissions you want to grant. This will be very helpful in case of huge number of tables.

No comments:

Post a Comment