SQL Language Guide : 8. SQL Statements : RETURN
 
Share this page                  
RETURN
Valid in: DBProc
The RETURN statement terminates a currently executing database procedure and gives control back to the calling application, and, optionally, returns a value. The RETURN statement can only be used inside a database procedure. The statement terminates the procedure and returns control to the application. (The calling application resumes execution at the statement following EXECUTE PROCEDURE.)
The optional return_status returns a value to the calling application when the RETURN statement executes. Return_status must be a non-null integer constant, variable, or parameter whose data type is comparable with the data type of the variable to which its value is assigned. If the return_status is not specified or if a return statement is not executed, the procedure returns 0 to the calling application.
The INTO clause of the EXECUTE PROCEDURE statement allows the calling application to retrieve the return_status once the procedure has finished executing.
The RETURN statement has the following format:
RETURN [return_status];
Permissions
This statement is available to all users.