Aller au contenu principal

BINARY type

Applies to: check marked yes Databricks SQL check marked yes Databricks Runtime

Represents byte sequence values.

Syntax​

BINARY

Limits​

The type supports byte sequences of any length greater or equal to 0.

Literals​

X { 'num [ ... ]' | "num [ ... ]" }

num: Any hexadecimal number from 0 to F.

The prefix X is case insensitive.

If the hexadecimal string literal has an odd length the parser prepends a 0.

Examples​

SQL
> SELECT X'1';
[01]

> SELECT X'1ABF';
[1A BF]

> SELECT X'';
[ ]

> SELECT CAST('Spark' AS BINARY);
[53 70 61 72 6B]