SELECT em tabelas e views do esquema MERCURY para ACESSOESCOLAR
-- SELECT EM TABELAS E VIEWS DO ESQUEMA MERCURY PARA ACESSOESCOLAR
set serveroutput on
DECLARE v_esquema_destino VARCHAR2 (600):= 'ACESSOESCOLAR';
BEGIN
FOR r IN (
SELECT OWNER, OBJECT_NAME FROM DBA_OBJECTS O WHERE O.owner IN('MERCURY') AND O.object_type IN ('TABLE','VIEW') AND O.STATUS='VALID' AND TEMPORARY ='N' GROUP BY OWNER, OBJECT_NAME
)
LOOP
EXECUTE IMMEDIATE 'GRANT SELECT ON '||'"'||r.OWNER||'"'||'.'||'"'||r.OBJECT_NAME||'"'||' to ' || v_esquema_destino;
DBMS_OUTPUT.PUT_LINE('GRANT SELECT ON '||r.OWNER||'.'||r.OBJECT_NAME||' to ' || v_esquema_destino);
END LOOP;
END;
-- GRANT SELECT, UPDATE, INSERT, DELETE DO ESQUEMA MERCURY PARA ACESSOESCOLAR
set serveroutput on
DECLARE v_esquema_destino VARCHAR2 (600):= 'ACESSOESCOLAR';
BEGIN
FOR r IN (
SELECT OWNER, OBJECT_NAME FROM DBA_OBJECTS O WHERE O.owner IN('MERCURY') AND O.object_type IN ('TABLE') AND O.STATUS='VALID' AND TEMPORARY ='N' GROUP BY OWNER, OBJECT_NAME
)
LOOP
EXECUTE IMMEDIATE 'GRANT SELECT, UPDATE, INSERT, DELETE ON '||'"'||r.OWNER||'"'||'.'||'"'||r.OBJECT_NAME||'"'||' to ' || v_esquema_destino;
DBMS_OUTPUT.PUT_LINE('GRANT SELECT, UPDATE, INSERT, DELETE ON '||r.OWNER||'.'||r.OBJECT_NAME||' to ' || v_esquema_destino);
END LOOP;
END;
SQL