您好,登錄后才能下訂單哦!
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;
/
======================================================
創(chuàng)建完 過程后直接調(diào)用
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.
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。