15.00 - HELP CAST - Teradata Database

Teradata Database SQL Data Definition Language Detailed Topics

Product
Teradata Database
Release Number
15.00
Content Type
Programming Reference
Publication ID
B035-1184-015K
Language
English (United States)

HELP CAST

HELP CAST Attributes

The following table lists the attributes reported by the HELP CAST statement:

 

Attribute

Data Type

Nullable?

Description

Source

VARCHAR(31)

No

The name of the source type.

Because the containing database is always SYSUDTLIB, it is not reported.

Target

VARCHAR(31)

No

The name of the target type.

Because the containing database is always SYSUDTLIB, it is not reported.

Cast Routine

VARCHAR(31)

No

If UDT_name is a structured UDT, this is the specific name of the external routine that provides the casting functionality.

If UDT_name is a distinct UDT and its casting functionality was system‑generated, this is the word System.

Because the containing database is always SYSUDTLIB, it is not reported.

As Assignment

VARCHAR(3)

No

  • NO specifies that the AS ASSIGNMENT option was not specified for this cast definition.
  • If the code is NO, implicit casting is not supported for this external routine.

  • YES specifies that the AS ASSIGNMENT option was specified for this cast definition.
  • If the code is YES, implicit casting is supported for this external routine if the value for the DisableImplCastForSysFuncOp DBS Control flag is set to 00x0.

    For details, see “Using the AS ASSIGNMENT Clause To Make a Cast Operation Implicitly Invokable” on page 213.

    Dictionary Source

    VARCHAR(128)

    No

    The attributes shown in this section are based upon and supersede corresponding older attributes, Source, Target, and Cast Routine, while providing additional functionality.

    The older attributes are retained for compatibility with legacy applications.

    For details, see the topics beginning with “Working with Object Name and Title Data in HELP Reports” on page 896.

    SQL Source

    VARCHAR(644)

    No

    Source Uescape

    VARCHAR(1)

    Yes

    Dictionary Target

    VARCHAR(128)

    No

    SQL Target

    VARCHAR(644)

    No

    Target Uescape

    VARCHAR(1)

    Yes

    Dictionary Cast Routine

    VARCHAR(128)

    No

    SQL Cast Routine

    VARCHAR(644)

    No

    Cast Routine Uescape

    VARCHAR(1)

    Yes

    Example : Source Castings Only

    The following example reports the source castings for the UDT named euro:

         HELP CAST SYSUDTLIB.euro SOURCE;

     

    Source    Target         Cast Routine         As Assignment
    ---------------------------------------------------------------------
    euro      DECIMAL(10,2)  System                   YES
    euro      us_dollar      EurotoUS                 NO

    Example : Target Castings Only

    The following example reports the target castings for the UDT named euro:

         HELP CAST SYSUDTLIB.euro TARGET;
     
    Source         Target         Cast Routine           As Assignment
    ----------------------------------------------------------------------
    DECIMAL(10,2)  euro           System                     YES
    us_dollar      euro           UstoEuro                   YES

    Example : All Castings For A UDT That Has A Single Casting Pair

    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/ REPLACE CAST” on page 212 for details

    Example : All Castings For A UDT That Has Multiple Casting Pairs

    The following example extends “Example 3: All Castings For A UDT That Has A Single Casting Pair” on page 906 to show what the output of running HELP CAST euro (see “Example 1: Source Castings Only” on page 906 and “Example 2: Target Castings Only” on page 906) with no options:

         HELP CAST euro;
     
    Source         Target         Cast Routine           As Assignment
    ----------------------------------------------------------------------
    euro           DECIMAL(10,2)  System                     YES
    DECIMAL(10,2)  euro           System                     YES
    us_dollar      euro           UstoEuro                   YES
    euro           us_dollar      EurotoUS                   NO

    Note the following things about this report:

  • Because this UDT has two casting pairs (euro:DECIMAL and euro:us_dollar), there are four rows in the report.
  • The euro:DECIMAL casting pair was system‑generated (which you can tell because its cast routine in both cases is named System), while the euro:us_dollar casting pair was user‑defined.
  • There is no implicit casting for the euro‑to‑us_dollar cast because it was not defined with the AS ASSIGNMENT option.
  • Related Topics

    See the documentation for the following statements and manual for additional information about creating castings for UDTs.

  • “CREATE CAST/ REPLACE CAST” on page 212
  • “SHOW object” on page 993
  • SQL External Routine Programming