Skip to content

RETURN

The RETURN statement returns the value of an expression.

RETURN is only valid within a scripting block.

Syntax

sql
RETURN expr;

Arguments

expr: The value or expression to return.

Usage Notes

  • A RETURN statement can be executed either from a stored procedure or from an anonymous block.

Possible return types for RETURN:

  • A SQL value.
  • A table. To return a table, a TABLE(...) clause must be used. If the block is inside a stored procedure, the CREATE PROCEDURE statement must include the RETURNS TABLE clause.

Example 1 | Expression

sql
CREATE PROCEDURE mkw_doku.return_me(my_string STRING)
RETURNS STRING
AS
    BEGIN
    RETURN :my_string;
    END;

CALL mkw_doku.return_me('Return this Text');
txt
Procedure 'mkw_doku.return_me' was successfully executed