BITWISE_SHIFT_RIGHT()
All functions > BITWISE > BITWISE_SHIFT_RIGHT()
Returns the bitstring shifted right by N positions, filling with zeros on the left.
Signatures
Returns: Shifted bitstring, or NULL if either operand is NULL
BITWISE_SHIFT_RIGHT(expr: BITSTRING, n: BIGINT) → BITSTRING sql
| Parameter | Type | Required | Description |
|---|---|---|---|
expr | BITSTRING | Yes | Input bitstring |
n | BIGINT | Yes | Number of bit positions to shift |
Notes
- Bits shifted beyond the right end are discarded
- New bits on the left are filled with zeros
- The length of the result is the same as the input
- Returns NULL if either input is NULL
Related operators
Examples
FeatureQL
SELECT
f1 := BITWISE_SHIFT_RIGHT('1001011'::BITSTRING, 3)::VARCHAR -- Shift right by 3
;Result
| f1 VARCHAR |
|---|
| 0001001 |
On this page