Example: Converting Salaries - 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™

Based on the following description of Salary, data is converted as illustrated in the following table (Δ = pad character):

Salary (DECIMAL(8,2), FORMAT '$$$,$$9.99')
Data Conversion Result
20000.00 Salary (CHAR(10)) '$20,000.00'
9000.00 Salary (CHAR(10)) 'Δ $9,000.00'
20000.00 Salary (FORMAT'9(5)') (CHAR (5)) '20000'
9000.00 CAST (Salary AS CHAR(10)) '$9,000.00Δ '

The resultant character string is either extended with pad characters or truncated to conform to the given character description.