Lưu ý
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử đăng nhập hoặc thay đổi thư mục.
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử thay đổi thư mục.
Applies to:
Databricks SQL
Databricks Runtime 11.3 LTS and above
Returns the value of a bit in a binary representation of an integral numeric. This function is a synonym for getbit function.
Syntax
bit_get(expr, pos))
Arguments
expr: An expression that evaluates to an integral numeric.pos: An expression of type INTEGER.
Returns
The result type is an INTEGER.
The result value is 1 if the bit is set, 0 otherwise.
Bits are counted right to left and 0-based.
If pos is outside the bounds of the data type of expr Databricks SQL raises an error.
Examples
> SELECT hex(23Y), bit_get(23Y, 3);
0
> SELECT hex(23Y), bit_get(23Y, 0);
1
> SELECT bit_get(23Y, 8);
Invalid bit position: 8 exceeds the bit upper limit
> SELECT bit_get(23Y, -1);
Invalid bit position: -1 is less than zero