Sybase 12.4.2 User Manual

Page of 536
Returning results from procedures
246
 
Notes
Default parameters can be used in calling functions. However, parameters 
cannot be passed to functions by name.
Parameters are passed by value, not by reference. Even if the function 
changes the value of the parameter, this change is not returned to the 
calling environment.
Output parameters cannot be used in user-defined functions.
User-defined functions cannot return result sets.
Returning results from procedures
Procedures can return results that are a single row of data, or multiple rows. In 
the former case, results can be passed back as arguments to the procedure. In 
the latter case, results are passed back as result sets. Procedures can also return 
a single value given in the RETURN statement.
 For simple examples of how to return results from procedures, see 
“Introduction to procedures”. For more detailed information, see the following 
sections.
Returning a value using the RETURN statement
A single value can be returned to the calling environment using the RETURN 
statement, which causes an immediate exit from the procedure. The RETURN 
statement takes the form:
RETURN expression
The value of the supplied expression is returned to the calling environment. To 
save the return value in a variable, an extension of the CALL statement is used:
Name
Fran Whitney
Matthew Cobb
Philip Chin
Julie Jordan
Robert Breault
...