BIT_OR
All functions > BITWISE > BIT_OR
Returns the bitwise OR of two bitstrings.
Signatures
Returns: Bitwise OR of the two operands
BIT_OR(left: BITSTRING, right: BITSTRING) → BITSTRING sql
| Parameter | Type | Required | Description |
|---|---|---|---|
left | BITSTRING | Yes | First bitstring operand |
right | BITSTRING | Yes | Second bitstring operand |
Notes
- Both operands must have the same length
- Each bit position is ORed independently: 0 OR 0 = 0, all other combinations = 1
- Returns NULL if either input is NULL
Examples
FeatureQL
SELECT
f1 := BIT_OR('1010'::BITSTRING, '0101'::BITSTRING)::VARCHAR, -- Complementary bits produce all 1s
f2 := BIT_OR('1100'::BITSTRING, '0011'::BITSTRING)::VARCHAR, -- Non-overlapping bits
f3 := BIT_OR('1000'::BITSTRING, '0000'::BITSTRING)::VARCHAR -- OR with zero preserves bits
;Result
| f1 VARCHAR | f2 VARCHAR | f3 VARCHAR |
|---|---|---|
| 1111 | 1111 | 1000 |
On this page