10.2. Functions

Some languages have a single subprogram type. A Java class has methods and a method may or may not return data. The C language is the same. The only subprogram in C is a function. A C function can return a value or modify the contents of an address value passed as an argument.

PL/SQL includes two types of subprograms: procedures and functions. Consider a package to be the encapsulation of operations on some object. That object can be a table, database pipe, host file, tables in a remote database, or many other options. Procedures take actions on the object and modify them. Functions provide a means to acquire status or state information about the object.

The package typically behaves as an API that hides an object and provides ...

Get Programming Oracle® Triggers and Stored Procedures, Third Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.