Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
A stored procedure is built for more than inserting, updating, or deleting data. It is also used to return data from a return value, a value in a parameter, a value within a single column of a single row known as a scalar value, or finally in one or more record sets. In the following sections, you will see each of these types of stored procedures, which will then be used in Chapter 16, when you look to call these from within an executable.
The first area you will look at is returning a value. This could be an error code or a specific value denoting a piece of information.
One reason for returning a value from a stored procedure is to indicate an error; this is done with the RETURN statement. This statement immediately stops a stored procedure and passes control back out of it. Therefore, any statements after the RETURN statement will not be executed.