Oracle prrocedures, packages and other objects that manage financial applications, healthcare, banking and other secure data typically handle PII, credit card numbers, encryption keys etc. that have to be masked/obfuscated for information security. If the source code is left as-is, it exposes all these information when Oracle dictionary views (such as user_source, dba_source etc.) are queried. By wrapping the PL/SQL code as shown below, the source code will masked. The first step is to wrap the source code using the wrap command. Then the wrapped file (filename.pbl) is to be compiled.

PL/SQL Wrap
CREATE OR REPLACE PROCEDURE p_test IS
BEGIN
  DBMS_OUTPUT.PUT_LINE('Hello Today Is '||TO_CHAR(sysdate,'day')||' '||
    TO_CHAR(sysdate,'mm/dd/yyyy'));
END p_test;
/

-- PL/SQL Source Code --> PLSQL Procedure (plain text)

-- OS command to wrap PL/SQL procedure (p_test)
wrap iname=C:\p_test.sql oname=p_test.plb  --> Wrap I/O 

-- Execute to compile (in SQL*Plus)
@c:\p_test.plb

-- After wrapping the procedure
SELECT text FROM user_source WHERE name='P_TEST'
;
--> Wrapped Procedure

Oracle registered trademark of Oracle Corporation.

Last Revised On: November 08, 2013

  74913