Distinct and Structured UDTs - Teradata Vantage

Teradata® VantageCloud Lake

Deployment
VantageCloud
Edition
Lake
Product
Teradata Vantage
Published
January 2023
Language
English (United States)
Last Update
2024-04-03
dita:mapPath
phg1621910019905.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
phg1621910019905

Vantage supports distinct and structured UDTs.

Structured/Distinct/Variant UDTs are only supported on the Block File System on the primary cluster. They are not available for the Object File System.
UDT Type Description Example
Distinct A UDT that is based on a single predefined data type, such as INTEGER or VARCHAR. A distinct UDT named euro that is based on a DECIMAL(8,2) data type can store monetary data.
Structured A UDT that is a collection of one or more fields called attributes, each of which is defined as a predefined data type or other UDT (which allows nesting). A structured UDT named circle can consist of x-coordinate, y-coordinate, and radius attributes.

Distinct and structured UDTs can define methods that operate on the UDT. For example, a distinct UDT named euro can define a method that converts the value to a US dollar amount. A structured UDT named circle can define a method that computes the area of the circle using the radius attribute.

Vantage 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 construct an instance of a dynamic UDT and define the attributes of the UDT at run time.

You can only specify a dynamic UDT as the data type of (up to eight) input parameters to external UDFs. Dynamic UDTs significantly increase the number of input arguments you can pass to external UDFs.