Oracle Unleashed- P10: When I first started using Oracle many years ago, it was possible to know the database and the tools available. With the rash of recent releases of different options for the database and the spate of new tools, only people who wear their underpants over their trousers will be able to know everything there is to know about the Oracle products. | Previo Page TOC Next Page Home 18 o Object-Oriented Programming with Packages The Package Specification The Package Body Package Variables and Initialization Overloading Retrieving Results Exception Handling Package Privileges Accessing Oracle Packages from Client Applications Object-Oriented Concepts Summary 18 Object-Oriented Programming with Packages Although Oracle is a relational database as opposed to an object-oriented database it provides a very powerful object-oriented feature in its implementation of packages. An Oracle package is a group of procedures functions variables constants cursors and type declarations that function as a logical unit. Packages provide many of the characteristics typically associated with object-oriented languages including encapsulation information hiding and function overloading. Packages can also provide improved performance because when a packaged object is referenced the entire package is loaded into memory. This reduces or eliminates disk I O for subsequent calls to objects in the package. As a result these calls execute more quickly than similar calls to stand-alone functions and procedures which must be read from disk as requested. There are two parts to a package the package specification and the package body. The package specification provides the interface through which applications and other subprograms access packaged objects. The package body contains the actual code for objects in the specification as well as any declarations and subprograms that are private to the package. If a package specification has only variables constants and type declarations it need not have a body at all. This independence from the body of the package enables the specification to be compiled separately even when a body is required. This can improve the development process by enabling developers to define the application interface before writing the underlying code. Objects referencing the package are dependent only on the specification. .