Chapter 17. Packages
A package is a grouping or packaging of PL/SQL code elements. Packages provide a structure (both logically and physically) in which you can organize your programs and other PL/SQL elements such as cursors, TYPEs, and variables. They also offer significant, unique functionality, including the ability to “hide” logic and data from view, and to define and manipulate “global” or session-persistent data.
Tip
In the first two editions of this book, I wrote that “Packages are among the least understood and most underutilized features of PL/ SQL. That is a shame, because the package structure is also one of the most useful constructs for building well-designed PL/SQL-based applications.” Fortunately, only the second of these statements is still true. Over the years, many developers have come to recognize and take advantage of the power of packages.
Why Packages?
The package is a powerful and important element of the PL/SQL language. It should be the cornerstone of any complex application development project. What makes the package so powerful and important? Consider the following advantages of the use of packages:
- Easier enhancement and maintenance of applications
As more and more of the production PL/SQL code base moves into maintenance mode, the quality of PL/SQL applications will be measured as much by the ease of maintenance as it is by overall performance. Packages can make a big difference in this regard. From data encapsulation (hiding all calls to SQL statements ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access