Updated on 2026-11-06 GMT+08:00

bin

The bin function is used to return the binary representation of a.

Syntax

bin(BIGINT a) 

Parameters

Parameter

Mandatory

Type

Description

a

Yes

DOUBLE, BIGINT, DECIMAL, or STRING

The format of parameter a is an integer format. If parameter a is not of type BIGINT, it is implicitly converted to BIGINT type before evaluation.

Return Values

Returns STRING type.

If a is NULL, NULL is returned.

Example Code

Returns 1.

select bin(1); 

Returns NULL.

select bin(null); 

Returns 1000.

select bin(8); 

Returns 1000.

select bin(8.123456);