Hexadecimal Byte Literals | Data Types and Literals | Teradata Vantage - Hexadecimal Byte 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 byte literal value.

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 XB determines the hexadecimal literal data type.

IF a hexadecimal literal uses this form … THEN the data type is …
'hexadecimal digits'XBV VARBYTE
'hexadecimal digits'XB

'hexadecimal digits'XBF

BYTE

ANSI Compliance

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

Syntax

'hexadecimal digits' XB [ V | F ]

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.
V
The hexadecimal literal is in byte variable format.
F
The hexadecimal literal is in byte fixed format. This is the default if F or V is not specified.

Usage Notes

Hexadecimal byte literal is the only form for entering a byte string.

Hexadecimal byte literals are represented by an even number of hexadecimal digits. Hexadecimal literals are extended on the right with zeros when required.

Consider the following table:

CREATE TABLE bvalues (b1 BYTE(2));

Suppose you insert the hexadecimal byte literal 'C1C'XB into column b1:

INSERT bvalues ('C1C'XB);

The value is extended on the right with zeros:

SELECT * FROM bvalues;

Result:

b1
----
C1C0

Example: Hexadecimal Byte Literal

Suppose the column CodeVal has been defined as BYTE(2).

CREATE TABLE bvalues (IDVal INTEGER, CodeVal BYTE(2));

To insert a BYTE string as a hexadecimal literal, use the following form:

INSERT bvalues (112193, '7879'XB) ;

To select those rows from CodeVal, specify the conditional like this:

SELECT IDVal FROM bvalues WHERE CodeVal = '7879'XB ;