17.20 - Importing and Exporting UDT Values - ODBC Driver for Teradata

ODBC Driver for Teradata® User Guide

Product
ODBC Driver for Teradata
Release Number
17.20
Published
June 2022
Language
English (United States)
Last Update
2022-06-21
dita:mapPath
uqj1639470627591.ditamap
dita:ditavalPath
nkw1500504256726.ditaval

A UDT can exist only on the database. Each UDT has an associated from-sql routine and to-sql routine. The from-sql routine generates a predefined type value from a UDT. It is automatically invoked when a UDT is exported from the database to a client system. The to-sql routine constructs a UDT value from a predefined type value. It is automatically invoked when importing values from a client system into a UDT on the database server. The from-sql routine and to-sql routine create a mapping between a UDT and a predefined type. The predefined type is called the external type of a UDT. A client application only deals with the external type; it does not deal directly with the UDT value.

For example, if a UDT named FULLNAME exists and the external type associated with FULLNAME is VARCHAR(46), then during an export of FULLNAME values, the database server converts the values from FULLNAME values to VARCHAR(46) values by invoking the from-sql routine associated with the FULLNAME UDT. As a result, the client should expect to receive the data in the same format as it receives VARCHAR(46) values.

Similarly, when values are provided by the client for import into a FULLNAME UDT, the client should provide values like it would provide values for a VARCHAR(46) field, and the database server then converts the values from VARCHAR(46) to FULLNAME values by invoking the to-sql routine associated with the FULLNAME UDT.