CREATE USER SM_VIEW IDENTIFIED BY PASSWORD;
GRANT CREATE SESSION TO SM_VIEW;
CREATE ROLE "SM_VIEWER" NOT IDENTIFIED;
begin
for c in (select table_name from all_tables where owner='SUPERMAG')
loop
begin
execute immediate
'GRANT SELECT ON supermag.' || c.table_name || ' to SM_VIEWER';
exception when others then null;
end;
end loop;
end;
/
GRANT SM_VIEWER TO SM_VIEW;
begin
for c in (select table_name from all_tables where owner='SUPERMAG')
loop
begin
execute immediate 'GRANT SELECT ON supermag.' || c.table_name || ' to ЮЗЕР with grant option';
end;
end loop;
end;
/