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

shiftrightunsigned

The shiftrightunsigned function is used to perform an unsigned right shift, shifting the binary representation of a right by b bits.

Syntax

shiftrightunsigned(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 2.

select shiftrightunsigned(16,3); 

Returns 536870910.

select shiftrightunsigned(-16,3); 

Returns 2.

select shiftrightunsigned(16.123456,3.123456); 

Returns NULL.

select shiftrightunsigned(null,3);