SQL - Dynamic
PT : Necessito mesmo hard coded na minha script ?
EN : Do I really need to hard coded my grant script ?
set serveroutput on size 1000000;
declare
cursor c1 is (
select 'grant select on wes.' || table_name || ' to wes_ro' cmd
from dba_objects
where
owner like 'WES'
and object_type in ('TABLE','TABLE PARTITION','TABLE SUBPARTITION','VIEW','MATERIALIZED VIEW','SEQUENCE')
);
begin
for i in c1
loop
dbms_output.put_line(' ran : ' || i.cmd);
execute immediate i.cmd ;
end loop;
end;
/
Thank you for reading, hope this post was helpful.
Rogerio
Comments