15.00 - Constructor Methods - Teradata Database

Teradata Database SQL Data Definition Language Detailed Topics

prodname
Teradata Database
vrm_release
15.00
category
Programming Reference
featnum
B035-1184-015K

Constructor Methods

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)” on page 758).
  • 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.