Skip navigation

GRANT SELECT on all tables in a schema

score 1680
You have not voted. Under Review - Voting Still Open

User often are asking for a single statement to Grant privileges in a single step.

 

there are multiple workarounds for not have a GRANT SELECT on all table

FOR x IN (SELECT * FROM user_tables)

LOOP  

EXECUTE IMMEDIATE 'GRANT SELECT ON ' || x.table_name || ' TO <<someone>>';

END LOOP;

 

or

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;

 

Oracle could implement a schema level grant

 

GRANT SELECT ON <schema name> to <<user>>

 

This request is now referenced with ER: 16899440 - SCHEMA WIDE PRIVILEGES

Comments

Vote history