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

Teradata Vantage™ - SQL Data Definition Language Detailed Topics

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Release Date
July 2021
Content Type
Programming Reference
Publication ID
B035-1184-171K
Language
English (United States)

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