Tasks You Must Perform To Create A Distinct UDT | Teradata Vantage - Tasks You Must Perform To Create A Distinct UDT - Analytics Database - Teradata Vantage

SQL Data Definition Language Detailed Topics

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
Language
English (United States)
Last Update
2023-07-11
dita:mapPath
vuk1628111288877.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
B035-1184
lifecycle
latest
Product Category
Teradata Vantage™

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 TeVantage.
  • 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 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: