A RETURN statement terminates the execution of a procedure and the control is returned to the calling code.

figure syntax return
RETURN statement
  • A RETURN statement with an expression cannot be used within a procedure with OPTIONS(MAIN).

  • A RETURN statement without an expression cannot be used within a procedure with RETURNS options.

  • A procedure with RETURNS options must have one or more RETURN statements.