Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
You want to perform an operation that produces two or more values, but a stored function can return only a single value.
Use a stored procedure that has OUT or INOUT parameters, and pass user-defined variables for those parameters when you invoke the procedure. A procedure does not "return" a value the way a function does, but it can assign values to those parameters, which will be the values of the variables when the procedure returns.