|Oracle® Database PL/SQL Language Reference
11g Release 2 (11.2)
Part Number E17126-03
RETURN statement immediately ends the execution of the subprogram or anonymous block that contains it.
In a function, the
RETURN statement assigns a specified value to the function identifier and returns control to the invoker, where execution resumes immediately after the invocation (possibly inside the invoking statement). Every execution path in a function must lead to a
RETURN statement (otherwise, the PL/SQL compiler issues compile-time warning PLW-05005).
In a procedure, the
RETURN statement returns control to the invoker, where execution resumes immediately after the invocation.
In an anonymous block, the
RETURN statement exits its own block and all enclosing blocks.
A subprogram or anonymous block can contain multiple
RETURNstatement differs from the
RETURNclause in a function heading, which specifies the data type of the return value.
See "expression ::=".
Optional when the
RETURN statement is in a pipelined table function. Required when the
RETURN statement is in any other function. Not allowed when the
RETURN statement is in a procedure.
RETURN statement assigns the value of
expression to the function identifier. Therefore, the data type of
expression must be compatible with the data type in the
RETURN clause of the function. For information about expressions, see "Expression".
In this chapter:
In other chapters: