Usage Notes - Teradata Vantage - Analytics Database

SQL Data Definition Language Syntax and Examples

Deployment
VantageCloud
VantageCore
Edition
VMware
Enterprise
IntelliFlex
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
ft:locale
en-US
ft:lastEdition
2025-11-06
dita:mapPath
jco1628111346878.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
mdr1472255012272
lifecycle
latest
Product Category
Teradata Vantage™
  • 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:
    • Self-references
    • Circular references
    • Forward references

      A forward reference is a case where an SQL UDF references another SQL UDF that does not yet exist.