Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
PL/SQL stored programming units are functions, procedures, packages, and triggers. Oracle maintains a unique list of stored object names for tables, views, sequences, stored programs, and types. This list is known as a namespace. Stored functions, procedures, and packages provide a way to hide implementation details in a program unit. While triggers work along the same lines as functions and procedures, they serve a different purpose that is covered in the next section of this appendix. Triggers also have their own separate namespace in Oracle, which means a trigger can have the same name as a table, view, stored program, sequence, or type.
PL/SQL implements functions with pass-by-value parameters and procedures with pass-by-reference parameters, as done in the Ada programming language. A package has two parts: a specification that acts like a declaration block and a body that provide implementations of those things defined in the specification or its own local declaration block. A package specification is a container of user-defined data type, function, and procedure definitions, and a package body is an implementation library for the components defined in the package specification. Package bodies can also have locally defined user-defined data type, function, and procedure definitions. These locally defined modules can be used inside the functions and procedures of the package but are not available externally.