The RETURNS and RETURNS STYLE Clauses - Advanced SQL Engine - Teradata Database

SQL External Routine Programming

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
17.00
Published
June 2020
Language
English (United States)
Last Update
2021-01-24
dita:mapPath
qwr1571437338192.ditamap
dita:ditavalPath
lze1555437562152.ditaval
dita:id
B035-1147
lifecycle
previous
Product Category
Teradata Vantage™

When invoking a scalar or aggregate UDF that is defined with a TD_ANYTYPE result parameter, you can use the RETURNS data type or RETURNS STYLE column expression clauses to specify the desired return type. The column expression can be any valid table or view column reference, and the return data type is determined based on the type of the column.

The RETURNS or RETURNS STYLE clause is not mandatory as long as the function also includes a TD_ANYTYPE input parameter. If you do not specify a RETURNS or RETURNS STYLE clause, then the data type of the first TD_ANYTYPE input argument is used to determine the return type of the TD_ANYTYPE result parameter. For character types, if the character set is not specified as part of the data type, then the default character set is used.

You can use these clauses only with scalar and aggregate UDFs. You cannot use them with table functions. Also, you must enclose the UDF invocation in parenthesis if you use the RETURNS or RETURNS STYLE clauses.