BITWISE_OR()

All functions > BITWISE > BITWISE_OR()

Returns the bitwise OR of two bitstrings.

Signatures

Returns: Result bitstring, or NULL if either operand is NULL

BITWISE_OR(left: BITSTRING, right: BITSTRING) → BITSTRING
sql
ParameterTypeRequiredDescription
leftBITSTRINGYesLeft operand
rightBITSTRINGYesRight 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

Availability

Available on DuckDB. Not available on Trino, Serving.

Related operators

Examples

FeatureQL
SELECT
    -- Complementary bits produce all 1s
    f1 := BITWISE_OR('1010'::BITSTRING, '0101'::BITSTRING)::VARCHAR
;
Result
f1 VARCHAR
1111