16.20 - Defining Functions that Use UDT Types - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL External Routine Programming

Advanced SQL Engine
Teradata Database
Release Number
Release Date
April 2020
Content Type
Programming Reference
Publication ID
English (United States)

UDTs are custom data types that allow you to model the structure and behavior of data that your application deals with.

Teradata Database supports two types of UDTs: distinct types and structured types. A distinct type is based on a single predefined data type such as INTEGER or VARCHAR. A structured type consists of one or more named attributes that can be predefined types or other UDTs.

In addition to specifying distinct and structured UDTs as the data types of columns in table definitions, you can specify them as the data types of scalar, aggregate, and table UDF parameters and return values.

Teradata Database also supports a form of structured UDT called dynamic UDT. Instead of using a CREATE TYPE statement to define the UDT, like you use to define a distinct or structured type, you use the NEW VARIANT_TYPE expression to declare an instance of a dynamic UDT and define the attributes of the UDT at run time.

You can specify a dynamic UDT as the data type of input parameters to UDFs. They cannot appear anywhere else.