Relationship Between Routines, Functions, and Procedures
A procedure is a routine that can accept arguments but does not return any values. A function is a routine that can accept arguments and returns one or more values. User-defined routine (UDR) is a generic term that includes both user-defined procedures and user-defined functions. For information about named and unnamed returned values, see Return Clause.
You can write a UDR in SPL (a SPL routine) or in an external language (an external routine) that the database server supports. Where the term UDR appears in this document, it can refer to both SPL routines and external routines.
The term user-defined procedure refers to SPL procedures and external procedures. User-defined function refers to SPL functions and external functions.
In the documentation of earlier releases, the term stored procedure was used for both SPL procedures and SPL functions. In this document, the term SPL routine replaces the term stored procedure. When it is necessary to distinguish between an SPL function and an SPL procedure, this document does so.
The term external routine applies to an external procedure or an external function, both constructs designating UDRs that are written in a programming language other than SPL. When it is necessary to distinguish between an external function and an external procedure, this document does so.