VARCHAR Data Type Usage Notes - Teradata Vantage

Teradata® VantageCloud Lake

Deployment
VantageCloud
Edition
Lake
Product
Teradata Vantage
Published
January 2023
ft:locale
en-US
ft:lastEdition
2024-12-11
dita:mapPath
phg1621910019905.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
phg1621910019905

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

A client application that talks to Vantage 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 server character sets. Apart from these definitions, LONG VARCHAR strings behave identically to VARCHAR strings.

Server Character Set Equivalent External Representation for LONG VARCHAR
  • 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.