Usage Notes | Character-to-Character Conversion | Teradata Vantage - General Usage Notes - Advanced SQL Engine - Teradata Database

SQL Data Types and Literals

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Published
July 2021
Language
English (United States)
Last Update
2021-07-27
dita:mapPath
tpf1598412463935.ditamap
dita:ditavalPath
tpf1598412463935.ditaval
dita:id
B035-1143
lifecycle
previous
Product Category
Teradata Vantageā„¢

If the source string (CHAR, VARCHAR, or CLOB) is longer than the target data type (CHAR, VARCHAR, or CLOB), excess characters are truncated.

Session Mode for INSERT or UPDATE Non-pad Characters Truncated to Store Character Values in a Table
ANSI Error is reported.
Teradata Error is not reported.

Pad characters are trimmed or appended, according to the following rules:

Source String Data Type Length Target Data Type Pad Characters
CHAR Longer than the target CLOB or VARCHAR Any trailing pad characters are trimmed.
CHAR, VARCHAR, or CLOB Shorter than the target CHAR Trailing pad characters are appended to the target.
CHAR All pad characters CLOB or VARCHAR Field is truncated to zero length.

Example: Character-to-Character Conversions

Following are examples of character-to-character conversions.

Character String String Length Character Description Conversion Result Converted Length
'HELLO' 5 CHAR(3) 'HEL', if session is in Teradata mode 3
Error, if session is in ANSI mode  
'HELLO' 5 CHAR(7) 'HELLO  ' 7
'HELLO' 5 VARCHAR(7) 'HELLO' 5
'HELLO  ' 7 VARCHAR(6) 'HELLO ' 6
'HELLO  ' 7 VARCHAR(3) 'HEL', if session is in Teradata mode 3
Error, if session is in ANSI mode