Bitwise OR

All functions > BITWISE > Bitwise OR

Returns the bitwise OR of two bitstrings.

Syntax

left | right  ·  BITWISE_OR(left, right)

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

Related Functions

Examples

BITWISE_OR(...)

FeatureQL
SELECT
    f1 := BITWISE_OR('1010'::BITSTRING, '0101'::BITSTRING)::VARCHAR, -- Complementary bits produce all 1s
    f2 := BITWISE_OR('1100'::BITSTRING, '0011'::BITSTRING)::VARCHAR, -- Non-overlapping bits
    f3 := BITWISE_OR('1000'::BITSTRING, '0000'::BITSTRING)::VARCHAR -- OR with zero preserves bits
;
Result
f1 VARCHARf2 VARCHARf3 VARCHAR
111111111000

Operator |

FeatureQL
SELECT
    f1 := ('1010'::BITSTRING | '0101'::BITSTRING)::VARCHAR, -- Complementary bits produce all 1s
    f2 := ('1100'::BITSTRING | '0011'::BITSTRING)::VARCHAR, -- Non-overlapping bits
    f3 := ('1000'::BITSTRING | '0000'::BITSTRING)::VARCHAR -- OR with zero preserves bits
;
Result
f1 VARCHARf2 VARCHARf3 VARCHAR
111111111000

Last update at: 2026/05/26 17:22:09