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

shiftleft

The shiftleft function is used to perform a signed left shift, shifting the binary representation of a left by b bits.

Syntax

shiftleft(BIGINT a, BIGINT b)

Parameters

Parameter

Mandatory

Type

Description

a

Yes

DOUBLE, BIGINT, DECIMAL, or STRING

The format of parameter a includes floating-point format, integer format, and string format. If parameter a is not of type BIGINT, it is implicitly converted to BIGINT type before evaluation.

b

Yes

DOUBLE, BIGINT, DECIMAL, or STRING

The format of parameter b includes floating-point format, integer format, and string format. If parameter b is not of type BIGINT, it is implicitly converted to BIGINT type before evaluation.

Return Values

Returns a value of type INT.

If a or b is NULL, NULL is returned.

Example Code

Returns 8.

select shiftleft(1,3); 

Returns 48.

select shiftleft(6,3); 

Returns 48.

select shiftleft(6.123456,3.123456); 

Returns NULL.

select shiftleft(null,3);