VARBINARY String Literals

VARBINARY string literals allow you to specify hexadecimal or binary digits in a string literal.

Syntax

X'<hexadecimal digits>'
B'<binary digits>'

Parameters

X or x

Specifies hexadecimal digits. The <hexadecimal digits> string must be enclosed in single quotes (').

B or b

Specifies binary digits. The <binary digits> string must be enclosed in single quotes (').

Examples

=> SELECT X'abcd';
 ?column?
----------
 \253\315
(1 row)
=> SELECT B'101100';
 ?column?
----------
 ,
(1 row)