Stored procedures can return the following types of information:
Return status – indicates whether or not the stored procedure completed successfully.
proc role function – checks whether the procedure was executed by a user with sa_role, sso_role, or ss_oper privileges.
Return parameters – report the parameter values back to the caller, who can then use conditional statements to check the returned value.
Return status and return parameters allow you to modularize your stored procedures. A set of SQL statements that are used by several stored procedures can be created as a single procedure that returns its execution status or the values of its parameters to the calling procedure. For example, many Adaptive Server system procedures include another procedure that verifies certain parameters as valid identifiers.
Remote procedure calls, which are stored procedures that run on a remote Adaptive Server, also return both status and parameters. All the examples below can be executed remotely if the syntax of the execute statement includes the server, database, and owner names, as well as the procedure name.