Defining Functions that Use UDT Types | Teradata Vantage - 17.10 - Defining Functions that Use UDT Types - Advanced SQL Engine - Teradata Database

Teradata Vantageā„¢ - SQL External Routine Programming

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Release Date
July 2021
Content Type
Programming Reference
Publication ID
B035-1147-171K
Language
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 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 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.