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
ParameterTypeRequiredDescription
leftBITSTRINGYesFirst bitstring operand
rightBITSTRINGYesSecond 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
    f4 := ('1010'::BITSTRING | '0101'::BITSTRING)::VARCHAR  -- Operator syntax: | for OR
;
Result
f1 VARCHARf2 VARCHARf3 VARCHARf4 VARCHAR
1111111110001111

Last update at: 2026/03/18 16:18:57
Last updated: 2026-03-18 16:19:34