PL/SQL User's Guide and Reference
Release 8.0

A54654_01

Library

Product

Contents

Index

Prev Next

D
PL/SQL Wrapper

This appendix shows you how to run the PL/SQL Wrapper, a standalone 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

Wrapped code is as portable as source code. The PL/SQL compiler recognizes and loads wrapped compilation units automatically. Other advantages include

Running the PL/SQL Wrapper

To run the PL/SQL Wrapper, enter the WRAP command at your system prompt using the following syntax:

WRAP INAME=input_file [ONAME=output_file]

You can use uppercase or lowercase. 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 PL/SQL packages and standalone subprograms:

All other SQL statements are passed intact to the output file. Comment lines (beginning with REM or --) are deleted unless they appear in a package or subprogram definition.

A wrapped package or subprogram definition has the form

<header> WRAPPED <body>

where header begins with the reserved word CREATE and ends with the name of the package or subprogram, and body is an intermediate form of object code that looks like a random sequence of characters. The keyword WRAPPED tells the PL/SQL compiler that the package or subprogram is wrapped.

The header can contain comments. For example, the Wrapper converts

CREATE OR REPLACE PACKAGE
-- Author: J Smith
-- Date: 11/15/94
mypkg AS ...

into

CREATE OR REPLACE PACKAGE
-- Author: J Smith
-- Date: 11/15/94
mypkg WRAPPED 8c724af33 ...

Generally, the output file is much larger than the input file.

Error Detection

If your input file contains syntactic errors, the PL/SQL Wrapper detects and reports them. However, the Wrapper cannot detect semantic errors because it does not resolve external references. That is done at compile time. So, only the PL/SQL compiler can detect semantic errors.




Prev

Next
Oracle
Copyright © 1997 Oracle Corporation.

All Rights Reserved.

Library

Product

Contents

Index