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.
- 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.
- 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).
- Code the appropriate external routines in either C or C++ (see Teradata Vantage™ - SQL External Routine Programming, B035-1147)
- Create new casts, ordering, or transforms for the UDT using the appropriate SQL CREATE statements from the following list:
- CREATE CAST (see CREATE CAST and REPLACE CAST).
- CREATE ORDERING (see CREATE ORDERING and REPLACE ORDERING).
- CREATE TRANSFORM (see CREATE TRANSFORM and REPLACE TRANSFORM).