sql help with grant script
Calling out for some SQL help..
I am trying to modify this free script I have obtained but only require select access for the Sequence object but require insert,update,delete,select etc for all other object types such as tables, views , procedures etc. How can I amend this script so that it caters for both types of grants. At presnt i have had to comment out the sequence object but do require the select permission only for sequences. Please advise. I have tried declaring another for loop but not had much luck.
admrole varchar2(80) := 'FLEETADMROLE';
userrole varchar2(80) := 'FLEETUSERROLE';
cursor get_obj is
select object_name,owner from all_objects
where owner = 'FLEET_DBA'
-- and object_type IN ('PACKAGE','FUNCTION','PROCEDURE','TABLE','VIEW','SEQUENCE','CLUSTER');
and object_type IN ('PACKAGE','FUNCTION','PROCEDURE','TABLE','VIEW','CLUSTER');
-- and object_name not in (select synonym_name
-- from all_synonyms
-- where owner='PUBLIC');
FOR obj_rec in get_obj LOOP
l_sql := 'GRANT UPDATE,SELECT,INSERT,DELETE on '||obj_rec.object_name||' to '||admrole;
t_sql := 'GRANT UPDATE,SELECT,INSERT,DELETE on '||obj_rec.object_name||' to '||userrole;
result := dbms_sql.execute(cursor_id);
Click Here to Expand Forum to Full Width