Hexadecimal Character Literals | Data Types and Literals | Teradata Vantage - Hexadecimal Character Literals - Teradata Vantage - Analytics Database

SQL Data Types and Literals

Deployment
VantageCloud
VantageCore
Edition
VMware
Enterprise
IntelliFlex
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
ft:locale
en-US
ft:lastEdition
2025-11-06
dita:mapPath
uds1628112204571.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
exs1472253032394
lifecycle
latest
Product Category
Teradata Vantage™

Declares a hexadecimal character literal value.

Hexadecimal literals consist of 0 to 31000 hexadecimal digits delimited by a matching pair of apostrophes, where a hexadecimal digit is a character from 0 to 9, a to f, or A to F.

ANSI Compliance

Hexadecimal character literals are Teradata extensions to the ANSI SQL:2011 standard.

Syntax

[ _Latin | _Unicode | _KanjiSJIS | _Graphic ] 'hexadecimal digits' { XC | XCV | XCF }

Syntax Elements

hexadecimal digits
A string of hexadecimal digits, where a hexadecimal digit is a character from 0 to 9, a to f, or A to F.
XC
XCV
The hexadecimal literal has data type VARCHAR (default).
XCF
The hexadecimal literal has data type CHAR.

Usage Notes

A hexadecimal character literal is useful for inserting character strings, such as TAB or BACKSPACE, that cannot generally be entered directly on the terminal keyboard.

The following apply to hexadecimal literals:
  • Hexadecimal character literals are represented by an even number of hexadecimal digits. Hexadecimal literals are extended on the right with zeros when semantically required. For example:
    _Latin 'C1C'XC = 'C1C0'XC
  • As with other character literals, hexadecimal character literals are translated to UNICODE internal form, unless the character set is KANJI1, and then the hexadecimal literal is kept in KANJI1 internal form.
  • When a hexadecimal character string is interpreted as _Unicode either explicitly or because it was the default character set, the form of the data is interpreted as UTF-16. Therefore properly paired surrogates, such as _Unicode ‘D800DC00’XC, are treated as supplementary code points and can be used in sessions with Unicode Pass Through enabled. For information about Unicode Pass Through, see International Character Set Support, B035-1125.
  • Multiple consecutive character literals (character literals, hexadecimal character literals, and Unicode delimited character literals) are treated as if the strings are concatenated.

Example: Hexadecimal Character Literal

Assume the user default character set is Latin. If the terminal keyboard does not include the brace characters {}, use the following hexadecimal literal to represent “{12}”:

'7B31327D'XC

where 7B represents the brace "{" and 7D represents the brace "}".