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.
- Casting (see CREATE CAST and REPLACE CAST).
- Ordering (see CREATE ORDERING and REPLACE ORDERING).
- Transformation (see CREATE TRANSFORM and REPLACE TRANSFORM).
- Instance methods of the following types:
- Observer methods
- Mutator methods
- Constructor methods (see CREATE METHOD, System-Generated Constructor Functions, and Constructor Methods).
- 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.