Using Structured UDTs | CREATE TYPE | Teradata Vantage - Function of Structured UDTs - Analytics Database - Teradata Vantage

SQL Data Definition Language Detailed Topics

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
ft:locale
en-US
ft:lastEdition
2024-12-13
dita:mapPath
vuk1628111288877.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
jbg1472252759029
lifecycle
latest
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.

Vantage does not support inheritance for structured UDTs.