Understanding functions

Functions are named program blocks containing a set of statements to be executed when the function is invoked with a CALL statement, or when the function is used in an expression, or when the function is registered in a callback mechanism like WHENEVER ERROR CALL.

A functions is defined in a program module, and is by default visible to all modules (i.e. a function is global by default), but it can also be declared as private to the module where it is defined.