Using Structured UDTs | CREATE TYPE | Teradata Vantage - Function of Structured UDTs - Advanced SQL Engine - Teradata Database

SQL Data Definition Language Detailed Topics

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
17.00
Published
June 2020
Language
English (United States)
Last Update
2021-01-24
dita:mapPath
jpx1556733107962.ditamap
dita:ditavalPath
lze1555437562152.ditaval
dita:id
B035-1184
lifecycle
previous
Product Category
Teradata Vantage™

The concept of structured UDTs is analogous to the structure construct defined for the C and C++ programming languages. In contrast with distinct UDTs, for which there is a one-to-one correspondence between a UDT and an underlying predefined data type, a structured UDT is a set of named attributes, limited to 512 per UDT definition and to roughly 4,000 total attributes per UDT , that can be treated as an encapsulated unit rather than as separate fields. See Workaround for Adding More Than 512 Attributes to a Structured UDT.

The attributes of a structured UDT can be any mix of predefined data types, distinct UDTs, or structured UDTs. Encapsulation of structured UDTs provides the ability to make modifications to any or all of the attributes inside the type without modifying the applications that access data having that type.

To manipulate structured UDT data, you are restricted to using the following operations and method types:
When you create a structured UDT, the system automatically generates the following instance method types for each attribute of the UDT:
  • An observer.
  • A mutator.

You can use these two types of instance method to retrieve (observe) information from an attribute or to update (mutate) the information in an attribute, respectively.

You can drop or replace user-defined methods. See ALTER TYPE and REPLACE METHOD. You cannot drop or replace system-generated methods because they are intrinsic components of the structured UDT attributes they manipulate. You must submit an ALTER TYPE statement with an appropriate DROP METHOD clause to drop a method. Similarly, the ALTER METHOD statement allows you to manipulate only the protection mode of the method or to recompile and relink it.

You can add new attributes to an existing structured UDT or drop existing attributes from it using the ALTER TYPE statement.

For each attribute dropped, the system also removes its associated observer and mutator methods.

For each attribute added, the system automatically generates the appropriate observer and mutator methods to support that attribute.

Teradata Database does not support inheritance for structured UDTs.