16.20 - SQL Definition of the UDT - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL External Routine Programming

Product
Advanced SQL Engine
Teradata Database
Release Number
16.20
Release Date
April 2020
Content Type
Programming Reference
Publication ID
B035-1147-162K
Language
English (United States)

Here is the SQL definition of a color_t distinct UDT and a circle_t structured UDT. Teradata Database automatically generates transform, cast, and ordering functionality for the color_t distinct UDT.

CREATE TYPE color_t
   AS VARCHAR(30)
   FINAL;

CREATE TYPE circle_t
   AS (x INTEGER, y INTEGER, radius INTEGER, color color_t)
   NOT FINAL
   CONSTRUCTOR METHOD circle_t( x INTEGER,
                                y INTEGER,
                                radius INTEGER,
                                color color_t )
      RETURNS circle_t
      SPECIFIC circle_t_constructor
      SELF AS RESULT
      NO SQL
      PARAMETER STYLE TD_GENERAL
      DETERMINISTIC
      LANGUAGE C,
   INSTANCE METHOD circle_t_FromSql()
      RETURNS VARCHAR(80)
      SPECIFIC circle_t_FromSql
      NO SQL
      PARAMETER STYLE TD_GENERAL
      DETERMINISTIC
      LANGUAGE C,
   INSTANCE METHOD circle_t_Ordering()
      RETURNS FLOAT
      SPECIFIC circle_t_Ordering
      NO SQL
      PARAMETER STYLE SQL
      DETERMINISTIC
      LANGUAGE C,
   INSTANCE METHOD VarcharCast()
      RETURNS VARCHAR(80)
      SPECIFIC circle_t_Cast
      NO SQL
      PARAMETER STYLE TD_GENERAL
      DETERMINISTIC
      LANGUAGE C;