Pridal: Pred 7 rokmi

Grant SELECT Insert Update to cpecific users and schemas in Oracle Database:
BEGIN
   FOR cur_rec IN (SELECT object_name, object_type
                    FROM user_objects
                    WHERE object_type IN ('TABLE', 'SEQUENCE'))
   LOOP
      BEGIN
         IF cur_rec.object_type = 'TABLE' THEN
             DBMS_OUTPUT.put_line ('GRANT SELECT, INSERT, UPDATE, DELETE ON &1' || '.' || cur_rec.object_name || ' TO &2');
         ELSE
           DBMS_OUTPUT.put_line ('GRANT SELECT ON &1' || '.' || cur_rec.object_name || ' TO &2');    
         END IF;
      EXCEPTION
         WHEN OTHERS
         THEN
            DBMS_OUTPUT.put_line ('FAILED: GRANT ' || cur_rec.object_type || ' "' || cur_rec.object_name || '"');
      END;
   END LOOP;
END;
/
Top