15.10 - RETURNS data type - Teradata Database

Teradata Database SQL Data Definition Language Syntax and Examples

Teradata Database
December 2015
Programming Reference

The predefined data type or UDT for the value returned by the method.

The method is responsible for providing the returned data with the correct type. If the return type is difficult for the method to create, you should also specify a CAST FROM clause so the system can perform the appropriate data type conversion. For more information about using CAST expressions, see SQL Functions, Operators, Expressions, and Predicates, B035-1145.

The result type has a dictionary entry in DBC.TVFields under the name RETURN0 [n], where n is a sequence of digits appended to RETURN0 rows to make each value unique, ensuring that no user-defined parameter names are duplicated. The value of n is incremented until it no longer duplicates a parameter name.

If there is no parameter name of RETURN0, then the n subscript is not used.

If the external routine for the method is written in C or C++, you can specify TD_ANYTYPE as a parameter data type.

See the CREATE FUNCTION/REPLACE FUNCTION topic “Returns Clause” in SQL Data Definition Language - Detailed Topics, B035-1184.

This clause is optional.

If you specify a RETURNS clause, it must be the same as the RETURNS clause specified for the corresponding CREATE TYPE.

If you do not specify a RETURNS clause for the method, then the RETURNS clause specified for the corresponding CREATE TYPE applies to this method by default.