Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Part V: Appendixes > Stored Functions, Procedures, and Packages

Stored Functions, Procedures, and Packages

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.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial