RETURN statement
Function
Syntax
Permissions
Side effects
See also
Description
Standards and
compatibility
Example
Use this statement to exit from a function or procedure unconditionally,
optionally providing a return value.
RETURN [ expression ]
None.
None.
"CREATE FUNCTION statement" on page 445
"CREATE PROCEDURE statement" on page 453
"BEGIN statement" on page 404
A RETURN statement causes an immediate exit from a function or
procedure. If expression is supplied, the value of expression is returned as
the value of the function or procedure.
Statements following a RETURN statement are not executed.
Within a function, the expression should be of the same data type as the
function's RETURNS data type.
Within a procedure, RETURN is used for Transact-SQL-compatibility, and
is used to return an integer error code.
♦
Persistent stored module feature.
SQL/92
♦
Transact-SQL procedures use the RETURN statement to
Sybase
return an integer error code.
♦
The following function returns the product of three numbers:
CREATE FUNCTION product (
a numeric,
b numeric,
c numeric )
RETURNS numeric
BEGIN
RETURN ( a * b * c );
END
♦
Calculate the product of three numbers:
SELECT product (2, 3, 4)
product(2, 3, 4)
24
Chapter 9 SQL Statements
593
Need help?
Do you have a question about the Adaptive Server Anywhere and is the answer not in the manual?
Questions and answers