Guidelines for Wrapping
- Wrap only the body of a package or object type, not the specification.This allows other developers to see the information they must use the package or type, but prevents them from seeing its implementation.
- Wrap code only after you have finished editing it.You cannot edit PL/SQL source code inside wrapped files. Either wrap your code after it is ready to ship to users or include the wrapping operation as part of your build environment.To change wrapped PL/SQL code, edit the original source file and then wrap it again.
- Before distributing a wrapped file, view it in a text editor to be sure that all important parts are wrapped.
Limitations of Wrapping
- Wrapping is not a secure method for hiding passwords or table names.Wrapping a PL/SQL unit prevents most users from examining the source code, but might not stop all of them.
- Wrapping does not hide the source code for triggers.To hide the workings of a trigger, write a one-line trigger that invokes a wrapped subprogram.
- Wrapping does not detect syntax or semantic errors.Wrapping detects only tokenization errors (for example, runaway strings), not syntax or semantic errors (for example, nonexistent tables or views). Syntax or semantic errors are detected during PL/SQL compilation or when executing the output file in SQL*Plus.
- Wrapped PL/SQL units are not downward-compatible.Wrapped PL/SQL units are upward-compatible between Oracle Database releases, but are not downward-compatible. For example, you can load files processed by the V8.1.5
wrap
utility into a V8.1.6 Oracle Database, but you cannot load files processed by the V8.1.6wrap
utility into a V8.1.5 Oracle Database.
Wrapping PL/SQL Code with wrap Utility
The
wrap
utility processes an input SQL file and wraps only the PL/SQL units in the file, such as a package specification, package body, function, procedure, type specification, or type body. It does not wrap PL/SQL content in anonymous blocks or triggers or non-PL/SQL code.
To run the wrap utility, enter the
wrap
command at your operating system prompt using the following syntax (with no spaces around the equal signs):
wrap iname=input_file [ oname=output_file ]
Follow the example:
CREATE OR REPLACE
PROCEDURE EMP_BONUS IS
CURSOR C IS SELECT
E.ENAME,E.JOB,E.SAL,NVL(E.COMM,0) INC FROM EMP E;
CHK NUMBER:=0;
BEGIN
SELECT COUNT(*) INTO CHK FROM BONUS B
WHERE TO_CHAR(TRUNC(B.PAIDON),'RRRRMON') =
TO_CHAR(SYSDATE,'RRRRMON');
IF CHK = 0 THEN
FOR I IN C LOOP
INSERT INTO BONUS(ENAME,JOB,SAL,COMM)
VALUES(I.ENAME,I.JOB,I.SAL,I.INC);
END LOOP;
COMMIT;
END IF;
END;
/
save the above code as C:\EMP_BONUS.prc
Open CMD and type
C:\> wrap iname=C:\EMP_BONUS.prc oname=C:\EMP_BONUS_WRAP.prc
Now check on your drive location open the wrapped text copy it paste it to check.
SQL> CREATE OR REPLACE PROCEDURE EMP_BONUS wrapped
2 a000000
3 b2
4 abcd
5 abcd
6 abcd
7 abcd
8 abcd
9 abcd
10 abcd
11 abcd
12 abcd
13 abcd
14 abcd
15 abcd
16 abcd
17 abcd
18 abcd
19 7
20 186 168
21 B6VF//FJC2va+k3ASva4zd7nDcgwgy5p2UjbynSKWGSleaGUa279Q6bb3mg5dgi05bBztZ1N
22 qAXldt3fhghfctscsewvfG4oxi3JDtjPLli2MPSohje8pqtf34/ji9aQaDEcCzQsq/DBL9Te
23 phgcYdtrzPv/l7tPL/a4dRmn3ivLmj7FzkNOcQuzZDs7fCF+u+0UV68QzRbCniTkSLfRJmBk
24 kK1iO3YHCKddNkrE+6ckafn/CmLOu8crZ7oXD3CswgtephMw74hWOSiLA41nJV8mccBFnhCI
25 SJ8TMcnHUw5yx8SAldgpvoj8E2u8iGXC8N+kpoaDsNIa92n3S1zeE400TtkoyYGHvw==
26
27 /
Procedure created
1 comment:
Thanks Hasan I had tested the same and it works :)
Post a Comment