CREATE TYPE (Structured Form) Constructor Methods | VantageCloud Lake - CREATE TYPE (Structured Form) Constructor Methods - 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

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 NEW Syntax 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')