create or replace procedure p_roleprivs(
v_role varchar2
)
is
cursor c_rolesys is select PRIVILEGE from ROLE_SYS_PRIVS where role=upper(v_role);
cursor c_roletab is select PRIVILEGE,TABLE_NAME from ROLE_TAB_PRIVS where ROLE=upper(v_role);
begin
--dbms_output.put_line('ROLE_SYS_privs : '||v_role );
for i_rolesys in c_rolesys loop
dbms_output.put_line(i_rolesys.privilege);
end loop;
--dbms_output.put_line('ROLE_TAB_privs : '||v_role);
for i_roletab in c_roletab loop
dbms_output.put_line(i_roletab.privilege||' in '||i_roletab.TABLE_NAME);
end loop;
end;
/
create or replace procedure p_privs(
v_name varchar2
)
is
cursor c_sysprivs is select privilege from dba_sys_privs where GRANTEE=upper(v_name);
cursor c_tabprivs is select privilege,TABLE_NAME from dba_tab_privs where GRANTEE=upper(v_name);
cursor c_role is select GRANTED_ROLE from dba_role_privs where GRANTEE=upper(v_name);
begin
--dbms_output.put_line('SYS_privs : ');
for i_sys in c_sysprivs loop
dbms_output.put_line(i_sys.privilege);
end loop;
--dbms_output.put_line('TAB_privs : ');
for i_tab in c_tabprivs loop
dbms_output.put_line(i_tab.privilege||' in '||i_tab.TABLE_NAME);
end loop;
dbms_output.put_line(' ROLE start : ');
for i_role in c_role loop
p_roleprivs(i_role.GRANTED_ROLE);
end loop;
end;
/
======================================================
创建完 过程后直接调用
SQL> exec p_privs('scott');
UNLIMITED TABLESPACE
READ in IMG
ROLE start :
CREATE SEQUENCE
CREATE TRIGGER
CREATE CLUSTER
CREATE PROCEDURE
CREATE TYPE
CREATE OPERATOR
CREATE TABLE
CREATE INDEXTYPE
CREATE TABLE
SELECT in EMP
CREATE ANY TABLE
CREATE SESSION
PL/SQL procedure successfully completed.
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。