Example: All Castings For A UDT That Has A Single Casting Pair - Advanced SQL Engine - Teradata Database

SQL Data Definition Language Detailed Topics

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
jpx1556733107962.ditamap
dita:ditavalPath
lze1555437562152.ditaval
dita:id
B035-1184
lifecycle
previous
Product Category
Teradata Vantage™

The following example reports both the source and target castings for the UDT named address:

     HELP CAST address;

Source       Target           Cast Routine           As Assignment
----------------------------------------------------------------------
address      VARCHAR(80)      address_2_char             YES
VARCHAR(80)  address          char_2_address             YES
Note the following things about this report:
  • The castings from address to VARCHAR(80) and from VARCHAR(80) to address are complementary to one another.
  • Both casting routines are user-defined, which you can tell because neither is named System.
  • This UDT has only one casting pair defined for it, neither of which is named System, which suggests that it is probably a structured type.

    Castings for structured types are never system-generated, while the system always generates default casts for distinct types. Because it is also possible to drop the system-generated casts for a distinct UDT and replace them with user-defined casts, the inference that the casting reported in this example is for a structured UDT cannot be made with certainty. See CREATE CAST and REPLACE CAST for details