Best practices suggest that you should provide parallel functionality for the transform group functionality and the equivalent cast functionality.
The following table explains what this means more explicitly:
|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 redundant functionality is particularly 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.
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…|
|distinct||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 functionality explicitly using the CREATE CAST and CREATE TRANSFORM statements, respectively.
|structured||create the necessary casts and transforms explicitly, using the same external routines for both.|
See CREATE CAST and REPLACE CAST for information about how to create casting functionality for a UDT.