Using Structured UDTs | CREATE TYPE | VantageCloud Lake - Function of 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

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.

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. 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.

Vantage does not support inheritance for structured UDTs.