Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: PL/SQL Encryption
Toby
From the 8.1.5 PL/SQL User's Guide and Reference Appendix C:
PL/SQL Wrapper
This appendix shows you how to run the PL/SQL Wrapper, a stand-alone utility that converts PL/SQL source code into portable object code. You can use the Wrapper to deliver PL/SQL applications without exposing your source code.
Major Topics
Advantages of Wrapping
Running the PL/SQL Wrapper
Advantages of Wrapping
The PL/SQL Wrapper converts PL/SQL source code into an intermediate form of object code. By hiding application internals, the Wrapper prevents
misuse of your application by other developers
exposure of your algorithms to business competitors
Wrapped code is as portable as source code. The PL/SQL compiler recognizes and loads wrapped compilation units automatically. Other advantages include
platform independence--you need not deliver multiple versions of the same compilation unit
dynamic loading--users need not shut down and relink to add a new feature
dynamic binding--external references are resolved at load time
strict dependency checking--invalidated program units are recompiled automatically
normal importing and exporting--the Import/Export utility accepts wrapped files
Running the PL/SQL Wrapper
To run the PL/SQL Wrapper, enter the wrap command at your operating system prompt using the following syntax:
wrap iname=input_file [oname=output_file]
Leave no space around the equal signs because spaces delimit individual arguments.
The wrap command requires only one argument, which is
iname=input_file
where input_file is the path and name of the Wrapper input file. You need not specify the file extension because it defaults to sql. For example, the following commands are equivalent:
wrap iname=/mydir/myfile
wrap iname=/mydir/myfile.sql
However, you can specify a different file extension as the following example shows:
wrap iname=/mydir/myfile.src
Optionally, the wrap command takes a second argument, which is
oname=output_file
where output_file is the path and name of the Wrapper output file. You need not specify the output file because its name defaults to that of the input file and its extension defaults to plb (PL/SQL binary). For example, the following commands are equivalent:
wrap iname=/mydir/myfile
wrap iname=/mydir/myfile.sql oname=/mydir/myfile.plb
However, you can use the option oname to specify a different file name and extension, as the following example shows:
wrap iname=/mydir/myfile oname=/yourdir/yourfile.obj
Input and Output Files
The input file can contain any combination of SQL statements. However, the PL/SQL Wrapper wraps only the following CREATE statements, which define object types, packages, or stand-alone subprograms:
CREATE [OR REPLACE] TYPE type_name ... OBJECT CREATE [OR REPLACE] TYPE BODY type_name CREATE [OR REPLACE] PACKAGE package_name CREATE [OR REPLACE] PACKAGE BODY package_name CREATE [OR REPLACE] FUNCTION function_name CREATE [OR REPLACE] PROCEDURE procedure_name
All other SQL statements are passed intact to the output file. Comment lines are deleted unless they appear inside an object type, package, or subprogram.
When wrapped, an object type, package, or subprogram has the form
<header> wrapped <body>
where header begins with the reserved word CREATE and ends with the name of the object type, package, or subprogram, and body is an intermediate form of object code. The word wrapped tells the PL/SQL compiler that the object type, package, or subprogram was processed by the Wrapper.
The header can contain comments. For example, the Wrapper converts
CREATE PACKAGE
-- Author: J. Hollings
-- Date: 12/15/98
banking AS
minimum_balance CONSTANT REAL := 25.00;
insufficient_funds EXCEPTION;
END banking;
into
CREATE PACKAGE
-- Author: J. Hollings
-- Date: 12/15/98
banking wrapped
0
abcd ...
Generally, the output file is much larger than the input file.
Suggestion: When wrapping a package (or object type), wrap only the body, not the spec. That way, you give other developers all the information (subprogram specs) they need to use the package without exposing its implementation.
Error Handling
If your input file contains syntax errors, the PL/SQL Wrapper detects and reports them. However, the Wrapper cannot detect semantic errors because it does not resolve external references. For example, the Wrapper does not report the following error (table or view does not exist):
CREATE PROCEDURE raise_salary (emp_id INTEGER, amount NUMBER) AS
BEGIN
UPDATE amp -- should be emp
SET sal = sal + amount WHERE empno = emp_id; END; The PL/SQL compiler resolves external references. So, semantic errors are reported when the Wrapper output file (.plb file) is compiled.
HTH. Pete
TC wrote:
> Hi,
> I've found wrap23.exe on my nt installation, but the command seems to
> give little in the way of information on how to use it... Is there any
> documentation on the utility or could anyone be so kind to inform me on it's
> usage?? I would have thought it would be wrap23.exe <filein>.sql
> <fileout>.sql but that isn't working...
>
> Cheers.
>
> Toby
--
Regards
Pete
Received on Wed Jun 30 1999 - 17:54:59 CDT