How CAST Differs from Teradata Conversion Syntax - Teradata Vantage NewSQL Engine - 16.20

Teradata Vantageā„¢ Data Types and Literals

prodname
Teradata Database
Teradata Vantage NewSQL Engine
vrm_release
16.20
category
Programming Reference
featnum
B035-1143-162K

The process for the CAST function is as follows:

  1. Convert the numeric value to a character string using the default or specified format for the numeric value.
  2. Trim leading and trailing pad characters.
  3. Extend to the right as required by the target string length.
  4. If truncation of non-pad characters is required to conform to the target string length, report string truncation error.

The CAST operation differs from the Teradata SQL conversion as follows:

  • Results are left justified. Column displays are not aligned.
  • Truncation of significant data generates a string truncation error.

Using Teradata conversion syntax (that is, not using CAST) for explicit conversion of numeric -to-character data requires caution.

The process is as follows:

  1. Convert the numeric value to a character string using the default or specified FORMAT for the numeric value.

    Leading and trailing pad characters are not trimmed.

  2. Extend to the right with pad characters if required, or truncate from the right if required, to conform to the target length specification.

    If non-pad characters are truncated, no string truncation error is reported.