16.20 - Tasks You Must Perform To Create A Distinct UDT - Teradata Database - Teradata Vantage NewSQL Engine

Teradata Vantage™ SQL Data Definition Language Detailed Topics

Product
Teradata Database
Teradata Vantage NewSQL Engine
Release Number
16.20
Release Date
March 2019
Content Type
Programming Reference
Publication ID
B035-1184-162K
Language
English (United States)

Because distinct types are created with inherent transform, ordering, and casting capabilities (see System-Generated Default Functionalities For Distinct UDTs), you need not take any action to create or activate any of these capabilities. These various functionalities are generated silently and activated at the time you submit the CREATE TYPE request.

This means that to create a minimal, fully functional distinct UDT, you need submit only a CREATE TYPE request. The following associated functionalities are then generated for you automatically by the system:
  • An ordering to enable two distinct UDTs to be compared
  • A transform group to enable the current distinct UDT to be passed between the client and Teradata Database.
  • A cast to enable casting, including implicit casting on assignment, from the underlying predefined data type to the distinct UDT and from the distinct UDT to the underlying predefined data type.

If your applications of the current distinct UDT require additional functionality, you can write instance methods in either the C or C++ languages, and then submit CREATE INSTANCE METHOD statements to declare any SQL-invoked methods to be associated with their distinct UDT.

You can define your own ordering, transform, and casting functionalities.

You must perform the following high-level general procedure.

  1. Drop the system-generated casts, orderings, or transforms you want to replace using the appropriate SQL DROP statements from the following list:
    • DROP CAST (see “DROP CAST” in Teradata Vantage™ SQL Data Definition Language Syntax and Examples).
    • DROP ORDERING (see DROP ORDERING).
    • DROP TRANSFORM (see DROP TRANSFORM).
  2. Code the appropriate external routines in either C or C++ (see Teradata Vantage™ SQL External Routine Programming , B035-1147 )
  3. Create new casts, ordering, or transforms for the UDT using the appropriate SQL CREATE statements from the following list: