Constructor Methods - Advanced SQL Engine - Teradata Database

SQL Data Definition Language Detailed Topics

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
17.00
Published
June 2020
Language
English (United States)
Last Update
2021-01-24
dita:mapPath
jpx1556733107962.ditamap
dita:ditavalPath
lze1555437562152.ditaval
dita:id
B035-1184
lifecycle
previous
Product Category
Teradata Vantage™

Constructor methods initialize a structured UDT instance with input arguments, creating an instance value for the type. The ANSI SQL standard defines something called a site, which is little more than an umbrella name assigned to a large set of different kinds of variables. Incorporating this definition, a structured UDT is seen to determine a type that is the data type of a site. Again, this does little more than state that a structured UDT is the data type of an instance of a variable.

A constructor method, then, assigns specific values to the elements of a site according to the attributes of the structured UDT that is the data type for that site.

The specification of a constructor method must comply with the following rules:
  • SELF AS RESULT must be specified as part of the method specification in the definition of the structured UDT (see CREATE TYPE (Structured Form)).
  • The method name must be identical to the name of the structured data type being defined.
  • The return data type specified for CONSTRUCTOR METHOD in the definition of the structured UDT must be identical to the data type for the corresponding attribute in the member list of the structured type definition.