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

SQL External Routine Programming

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
17.00
Published
June 2020
Language
English (United States)
Last Update
2021-01-24
dita:mapPath
qwr1571437338192.ditamap
dita:ditavalPath
lze1555437562152.ditaval
dita:id
B035-1147
lifecycle
previous
Product Category
Teradata Vantage™

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 Teradata Database 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 Teradata Database uses for comparisons.

Teradata Database 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 Teradata Database automatically generates transform and ordering functionality when you create a distinct type, you can drop the functionality and provide your own. Note that Teradata Database does not automatically generate ordering functionality for distinct UDTs where the source data type is a LOB.