15.00 - Creating Parallel Cast and Transform Functionality - Teradata Database

Teradata Database SQL Data Definition Language Detailed Topics

Teradata Database
Release Number
Content Type
Programming Reference
Publication ID
English (United States)

Creating Parallel Cast and Transform Functionality

Best practices recommends pairing transform group functionality (see “CREATE TRANSFORM/ REPLACE TRANSFORM” on page 694) with the equivalent cast functionality. Create parallel functionalities for the two conversion types, for example:


Cast Functionality

Equivalent Transform Functionality

External predefined data type to UDT cast

External predefined data type to UDT tosql transform

UDT to external predefined data type cast

UDT to external predefined data type fromsql transform

This is especially recommended if you want to use a UDT in the same way you would use any other data type, especially with respect to load utilities and the USING row descriptor, it is recommended that the type developer back up their tosql and fromsql functionality with equivalent external type (predefined) to UDT and UDT to external type (predefined) implicit casts, respectfully.

The simplest way to accomplish these equivalencies is to reference the same external routines in both the CREATE TRANSFORM and CREATE CAST statements for the same UDT.

The implications of this best practice differ for distinct and structured UDTs as follows:


FOR this kind of UDT …

You must do the following work to create parallel casting and transform functionality…


none if you plan to use the system-generated casts and transforms.

However, if you decide to write your own external cast and transform routines for the UDT, you must create the parallel cast and transform functionalities explicitly using the CREATE CAST and CREATE TRANSFORM statements, respectively.


create the necessary casts and transforms explicitly, using the same external routines for both.

See “CREATE CAST/ REPLACE CAST” on page 212 and “CREATE TRANSFORM/ REPLACE TRANSFORM” on page 694 for information about how to use those statements.