2.4. Organizing Package Source Code

Most Oracle shops still rely on SQL*Plus to create and compile PL/SQL programs. This means that the source code resides in one or more operating system files. To avoid losing control of that source, you should adopt some simple conventions for the extensions of your files. The approach I have taken is shown in the table below.

File ExtensionDescription
procname.spThe definition of a stored procedure.
funcname.sfThe definition of a stored function.
pkgname.sppA stored package definition that contains the code for both the package specification and the package body.
pkgname.spsThe definition of a stored package specification only.
pkgname.spbThe definition of a stored package body only.
scriptname.sqlAn anonymous PL/SQL block or a SQL*Plus script (SQL statement plus SQL*Plus commands).
procname.wpThe wrapped[2] definition of a stored procedure.
funcname.wfThe wrapped definition of a stored function.
pkgname.wppA stored package definition that contains the wrapped code for both the package specification and the package body.
pkgname.wpsThe wrapped definition of a stored package specification only.
pkgname.wpbThe wrapped definition of a stored package body only.
scriptname.sqlAn anonymous PL/SQL block or a SQL*Plus script (SQL statement plus SQL*Plus commands).

[2] As of PL/SQL Release 2.2, you can "wrap" your PL/SQL source code into an encrypted format. This format can be compiled into the database, but is not readable. Wrapped code is primarily of value ...

Get Advanced Oracle PL/SQL Programming with Packages now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.