17.10 - Usage Notes - 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)

Storage

Character data is allocated either in terms of characters or in terms of bytes, depending on the server character set used. The number of bytes of storage per character also varies depending on the server character set, as illustrated by the following table.

Server Character Set Server Form-of-Use Server Space Allocation Sharable Among Heterogeneous Clients?
LATIN Fixed 8-bit LATIN Character-based Yes
UNICODE Fixed16-bit UNICODE
GRAPHIC Fixed 16-bit UNICODE
KANJISJIS Mixed single and multibyte KANJISJIS Byte-based Yes

Any conversion to or from client system data types is done by Vantage. This data type supports international character sets.

External Representation of VARCHAR

Whenever a client application talks to Vantage, it indicates its character set (form-of-use for character data). The server returns all character data to the application in that form.

For information on the number of bytes exported for the VARCHAR type, see Teradata SQL Character Strings and Client Physical Bytes.

External Representation of LONG VARCHAR

For information on the number of bytes exported for the LONG VARCHAR type, see Teradata SQL Character Strings and Client Physical Bytes.

The following table shows how LONG VARCHAR data is represented for the various server character sets. Apart from these definitions, LONG VARCHAR strings behave identically to VARCHAR strings.

FOR this server character set … The external representation for LONG VARCHAR is equivalent to …
  • LATIN
  • KANJI1
VARCHAR(64000)
  • UNICODE
  • GRAPHIC
  • KANJISJIS
VARCHAR(32000)

External Representation of VARGRAPHIC

The following table lists the client representation for the IBM DB2 VARGRAPHIC type.

Determining the application definitions and client data types is the responsibility of the application programmer.

Define the length of the VARGRAPHIC(n) string as k, where 0 ≤ k ≤ n.

Client CPU Architecture Client Internal Data Format
IBM mainframe Two byte SMALLINT length count k followed by k DB2 GRAPHIC characters for a total of 2+2k EBCDIC bytes.

Display Format

The default display format for VARCHAR(n) is X(n).

The default display format for LONG VARCHAR is either X(32000) or X(64000) depending on the server character set in effect.

For more information, see Data Type Default Formats.

Graphic Data

You can use the VARGRAPHIC or LONG VARGRAPHIC to represent multibyte character data.

VARGRAPHIC(n) is equivalent to VARCHAR(n) CHARACTER SET GRAPHIC. For best practice, define all VARGRAPHIC(n) data as VARCHAR(n) CHARACTER SET GRAPHIC.

The maximum value for n in a VARCHAR(n) CHARACTER SET GRAPHIC definition is 32000. There is no default length; therefore, omitting the length specification results in an error.

LONG VARGRAPHIC is equivalent to LONG VARCHAR CHARACTER SET GRAPHIC. For best practice, define all LONG VARGRAPHIC data as LONG VARCHAR CHARACTER SET GRAPHIC.