CREATE OR REPLACE PROCEDURE p_wraped_user AUTHID CURRENT_USER AS --Created by xsb on 2006-11-10 --For:批量加密本用户下的所有代码,包括存储过程、函数、包。 v_procs dbms_sql.varchar2a;
BEGIN FOR n IN (SELECT DISTINCT NAME, TYPE FROM user_source WHERE NAME > 'P_WRAPED_USER' AND TYPE > 'TYPE' MINUS SELECT DISTINCT NAME, TYPE FROM user_source WHERE line = 1 AND instr(text, 'wrapped') > 0 --WHERE NAME = 'GET_CLERK' --AND -- TYPE = 'PACKAGE BODY' ORDER BY TYPE) LOOP FOR i IN (SELECT rownum rn, text FROM (SELECT decode(line, 1, 'create or replace ') || text text FROM user_source WHERE NAME = n.NAME AND TYPE = n.TYPE ORDER BY line)) LOOP v_procs(i.rn) := i.text; END LOOP; dbms_ddl.create_wrapped(v_procs, 1, v_procs.COUNT); v_procs.DELETE; END LOOP;