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 |