Functions
Similar to a stored procedure, a function is a named derivative of a PL/SQL block that is physically stored within the Oracle database schema.
The key features of stored functions are as follows:
- A function can accept parameters in all three modes (
IN
,OUT
, andIN
OUT
) and mandatorily returns a value. - Functions can be called in SQL statements (
SELECT
and DMLs). Such functions must accept onlyIN
parameters of valid SQL types. Alternatively, a function can also be invoked fromSELECT
statements if the function body obeys the database purity rules. - If the function is called from an SQL statement, its return type should be a valid SQL data type. If the function is invoked from PL/SQL, the return type should be a valid PL/SQL type.
Note
Starting ...
Get Advanced Oracle PL/SQL Developer's Guide - Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.