 |
|
PL/SQL Parameters for
Functions
Oracle Tips by
Burleson
|
Parameters for functions are handled in the same way as parameters
for procedures. Function parameters may be IN parameters,
OUT parameters, or IN OUT parameters. Functions may accept
no parameters, one parameter, or many parameters—this is decided by
you, the application developer.
Datatypes
Functions are very much like procedures, and the parameters for
functions follow the same rules as the parameters for procedures.
Using OUT and IN OUT Parameters
By definition, a PL/SQL function should return a value only through
the use of the RETURN statement. However, Oracle allows you to
define parameters for functions using the OUT and IN OUT
definitions.
Using this approach allows you to have a function return more than
one value; however, this is poor programming style and is not
recommended. Also, consider that, at some point in the future, Oracle
may not allow OUT and IN OUT parameters to be defined
for functions. To be safe, it’s better to only return values from
functions using the RETURN statement.
This is an excerpt from the book "High Performance Oracle
Database Automation" by Jonathan Ingram and Donald K.
Burleson, Series Editor. |