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

Teradata Vantageā„¢ - Data Types and Literals

Advanced SQL Engine
Teradata Database
Release Number
Release Date
July 2021
Content Type
Programming Reference
Publication ID
English (United States)

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  ' 7 VARCHAR(3) 'HEL', if session is in Teradata mode 3
Error, if session is in ANSI mode