您好,登錄后才能下訂單哦!
今天寫了一個存儲過程,需要通過dblink把其他用戶下面的表的數據增量copy到目標表中,結果訪問其他系統的表的時候,在存儲過程中一直有問題,在Stack Overflow中找到了答案。
In stored procedures, functions, and definers-rights packages, roles (such as
SELECT_CATALOG_ROLE
) are disabled. Therefore, such a PL/SQL program can only fetch metadata for objects in its own schema . If you want to write a PL/SQL program that fetches metadata for objects in a different schema (based on the invoker's possession ofSELECT_CATALOG_ROLE
), you must make the program invokers-rights.
To do this, you must add
authid
to your procedure.
create procedure tests authid CURRENT_USER is l_foo clob;beginselectregexp_replace( dbms_metadata.get_ddl('USER', 'SCOTT', null) || dbms_metadata.GET_GRANTED_DDL ('SYSTEM_GRANT', 'SCOTT') || dbms_metadata.GET_GRANTED_DDL ('OBJECT_GRANT', 'SCOTT') || dbms_metadata.GET_GRANTED_DDL ('ROLE_GRANT', 'SCOTT'),'"' || chr(10), '";' || chr(10)) into l_foo from dual;end;/SQL> EXEC tests PL/SQL procedure successfully completed
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。