17.10 - Example - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - Data Types and Literals

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Release Date
July 2021
Content Type
Programming Reference
Publication ID
B035-1143-171K
Language
English (United States)
USING Ext2 (CHAR(5)) 
INSERT INTO Test2 (Col2)
VALUES (:Ext2 (DECIMAL(5), FORMAT '99999S')); 

where Ext2 contains the strings ‘5678B’ and ‘9012L’.

Because Col2 does not have an attached FORMAT phrase, a simple SELECT, such as the following example, returns the results as seen immediately following.

SELECT Col2 FROM Test2; 
   
Col2  
-------
   
 56782.
-90123.

A sign FORMAT phrase must be included in the SELECT statement in order to retrieve the values ‘5678B’ and ‘9012L’.

It is important to remember this rule when manipulating signed zoned decimal values, especially when using sophisticated facilities like subqueries.