Return to Snippet

Revision: 60861
at November 14, 2012 03:55 by thescorpion


Initial Code
-----Grant
BEGIN
   FOR R IN (SELECT owner, object_name ,object_type FROM All_Objects Where OWNER = 'OTELO' And object_type In ('VIEW','TABLE')) LOOP
      Begin
        EXECUTE IMMEDIATE 'grant select on '||R.owner||'.'||R.object_name||' to AUDITOR';
      Exception 
         When Others Then
           DBMS_OUTPUT.put_line(Sqlerrm);  
      End ;
   END LOOP;
END;
-----revoke

BEGIN
   FOR R IN (SELECT owner, object_name ,object_type FROM All_Objects Where OWNER = 'APEX_030200' And object_type In ('VIEW','TABLE')) LOOP
      Begin
        EXECUTE IMMEDIATE 'REVOKE All ON '||R.owner||'.'||R.object_name||' FROM AUDITOR';
      Exception 
         When Others Then
           DBMS_OUTPUT.put_line(Sqlerrm);  
      End ;
   END LOOP;
END;

Initial URL

                                

Initial Description
Uso de Grant y Revoke de objetos masivos de distintos user

Initial Title
Grant y Revoke sobre objetos - dinamico

Initial Tags
sql, Oracle

Initial Language
SQL