- RETURN is an SQL control statement that can only be executed from within an SQL UDF.
- You cannot specify more than one RETURN statement per SQL UDF.
- The data type of value_expression must match the data type specified by the RETURNS clause of the SQL UDF definition or it must be capable of being cast implicitly to the data type specified in the RETURNS clause.
The specified data types can be any valid Teradata type.
- value_expression cannot contain references to tables.
- value_expression cannot contain scalar subqueries such as those made by DML statements.
- value_expression can contain references to parameters, constants, SQL UDFs, external UDFs, and methods.
- value_expression cannot be a conditional expression or have a Boolean return type.
- value_expression can contain arithmetic values and functions, string functions, DateTime functions, and SQL operators that define a scalar result.
- value_expression cannot contain aggregate or ordered analytic functions.
- If you specify a reference to an SQL UDF in the RETURN statement, it cannot be any of the following types of reference:
- Circular references
- Forward references
A forward reference is a case where an SQL UDF references another SQL UDF that does not yet exist.