user1 is the current user.
user2 is the grantee.
sqlplus
conn user1/....
declare
nume varchar2(50);
begin
FOR nume IN (SELECT * FROM user_views )
LOOP
EXECUTE IMMEDIATE 'GRANT SELECT ON ' || nume || ' TO user2';
END LOOP;
FOR nume IN (SELECT * FROM user_tables )
LOOP
EXECUTE IMMEDIATE 'GRANT SELECT ON ' || nume || ' TO user2';
END LOOP;
end;
That's it!
Niciun comentariu:
Trimiteți un comentariu