Functions That Implement Functionality for a UDT | Teradata Vantage - 17.10 - Functions That Implement Functionality for a UDT - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL External Routine Programming

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Release Date
July 2021
Content Type
Programming Reference
Publication ID
B035-1147-171K
Language
English (United States)

Functions that provide cast, ordering, or transform functionality for a UDT must satisfy certain requirements.

IF the UDT is … AND the function provides … THEN the C/C++ function must …
structured cast functionality from another UDT or predefined type to the UDT set the attribute values of the UDT result using the value of the input argument.
cast functionality from the UDT to another UDT or predefined type set the value of the result using the attribute values of the UDT input argument.
transform functionality for importing the UDT to the server transform the value of the predefined type input argument into attribute values of the UDT result.
transform functionality for exporting the UDT from the server transform the attribute values of the UDT into an appropriate value for the predefined type result.
ordering functionality for comparing two UDTs use the attribute values of the UDT to set the result to a value that Vantage uses for comparisons.
distinct cast functionality from another UDT or predefined type to the UDT set the value of the UDT result using the value of the input argument.
cast functionality from the UDT to another UDT or predefined type set the value of the result using the value of the UDT input argument.
transform functionality for importing the UDT to the server transform the value of the predefined type input argument into the value of the UDT result.
transform functionality for exporting the UDT from the server transform the value of the UDT into an appropriate value for the predefined type result.
ordering functionality for comparing two UDTs use the value of the UDT to set the result to a value that Vantage uses for comparisons.

Vantage automatically generates cast functionality between a distinct type and its predefined source type. You can create additional functions for casting between a distinct type and other predefined data types or UDTs.

Although Vantage automatically generates transform and ordering functionality when you create a distinct type, you can drop the functionality and provide your own. Note that Vantage does not automatically generate ordering functionality for distinct UDTs where the source data type is a LOB.