User-Defined Types - TARA/ABU

Teradata Archive/Recovery Utility Reference

Product
TARA/ABU
Release Number
15.10
Language
English (United States)
Last Update
2018-10-07
dita:id
B035-2412
lifecycle
previous
Product Category
Teradata Tools and Utilities

User-Defined Types (UDTs) allow the creation of custom data types that model the structure and behavior of data in applications. UDTs augment the Teradata Database with data types that have capabilities not offered by Teradata predefined (built-in) data types. A UDT can only exist on the Teradata Database server.

Teradata Database supports two types of UDTs: distinct and structured.

  • A distinct UDT is based on a single predefined data type such as INTEGER or VARCHAR. It redefines an already-defined SQL data type.
  • Example

    Define 'Salary' as a Decimal (9,2), but with a function that prevents someone from entering a value of less than 20,000 or more than 2,000,000.

  • A structured UDT is a collection of fields called attributes, each of which is defined as a predefined data type or other UDT (which allows nesting).
  • Example

    If 'Address' is defined as a UDT with subfields for Street, Apartment, City, State, and Zip Code, Transform functions must be provided that convert input and output data into and from an 'Address' object. Input and output data as a string with all the fields concatenated, using fixed field lengths or a delimiter such as a comma between them.