The process for the CAST function is as follows:
- Convert the numeric value to a character string using the default or specified format for the numeric value.
- Trim leading and trailing pad characters.
- Extend to the right as required by the target string length.
- 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:
- 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.
- 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.