How CAST Differs from Teradata Conversion Syntax - Advanced SQL Engine - Teradata Database

SQL Data Types and Literals

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
17.00
Published
June 2020
Language
English (United States)
Last Update
2021-01-22
dita:mapPath
zsn1556242031050.ditamap
dita:ditavalPath
lze1555437562152.ditaval
dita:id
B035-1143
lifecycle
previous
Product Category
Teradata Vantageā„¢

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.