Restrictions to Using Structured UDTs | CREATE TYPE | Teradata Vantage - Constructor Methods - 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
Language
English (United States)
Last Update
2023-07-11
dita:mapPath
vuk1628111288877.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
B035-1184
lifecycle
latest
Product Category
Teradata Vantage™

A structured UDT can have more than one constructor method, each of which provides a different initialization option. Constructors have the same method name; however, their parameter lists are different, meaning that their method signatures are different.

The following is an example of a constructor method for the structured type address:

CREATE TYPE address
...
CONSTRUCTOR METHOD address(VARCHAR(20), CHARACTER(5) )
RETURNS address
SELF AS RESULT
LANGUAGE C
DETERMINISTIC

This constructor method takes two character strings as input and uses them to initialize the attributes of the address structured type.

You can invoke constructor methods using the NEW syntax (see Teradata Vantage™ - SQL Functions, Expressions, and Predicates, B035-1145 for details).

The following bullets briefly summarize how to invoke a constructor method:
  • NEW syntax:
    NEW structuredTypeName( ... )
  • NEW example:
    NEW address('10795 Via Del Campo', '92127')