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
;
Result
f1 VARCHARf2 VARCHARf3 VARCHAR
111111111000

Last update at: 2026/03/03 16:47:38
Last updated: 2026-03-03 16:48:19