15.10 - Hexadecimal Character Literals - Teradata Database

Teradata Database SQL Data Types and Literals

Teradata Database
Programming Reference

Declares a hexadecimal character literal value.



This syntax element …

Specifies …


that the characters represented by the hexadecimal literal are within the repertoire of this (optional) character set. The default is the user default character set. Supported character sets are as follows:

  • _Latin specifies the LATIN character set.
  • _Unicode specifies the UNICODE character set.
  • _Graphic specifies the GRAPHIC character set.
  • _KanjiSJIS specifies the KANJISJIS character set.
  • Teradata Database is transitioning to the Unicode delimited character literal and is no longer supporting the KANJI1(_Kanji1) form of the hexadecimal character literal. Its use should be discontinued and Unicode delimited character literals should be used instead.

    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.


    that the hexadecimal literal is in character variable format. This is the default if V or F is not specified.


    that the hexadecimal literal is in character fixed format.

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

    Hexadecimal literals consist of 0 to 62000 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.

    The modifier following the XC determines the hexadecimal literal data type.


    IF a hexadecimal literal uses this form …

    THEN the data type is …

    'hexadecimal digits'XC

    'hexadecimal digits'XCV


    'hexadecimal digits'XCF


    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 rules 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.
  • Multiple consecutive character literals (both character literals and hexadecimal character literals) are treated as if the strings are concatenated.
  • 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}”:


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