BITWISE_XOR()
All functions > BITWISE > BITWISE_XOR()
Returns the bitwise XOR (exclusive OR) of two bitstrings.
Signatures
Returns: Result bitstring, or NULL if either operand is NULL
BITWISE_XOR(left: BITSTRING, right: BITSTRING) → BITSTRING sql
| Parameter | Type | Required | Description |
|---|---|---|---|
left | BITSTRING | Yes | Left operand |
right | BITSTRING | Yes | Right operand |
Notes
- Both operands must have the same length
- Each bit position is XORed independently: different bits = 1, same bits = 0
- XOR is its own inverse: BITWISE_XOR(BITWISE_XOR(a, b), b) = a for the same-length bitstrings a, b
- Returns NULL if either input is NULL
- The
^token is numeric exponentiation in FeatureQL, not bitstring XOR—useBITWISE_XOR
Related operators
Examples
FeatureQL
SELECT
f1 := BITWISE_XOR('1010'::BITSTRING, '0110'::BITSTRING)::VARCHAR -- Different bits become 1
;Result
| f1 VARCHAR |
|---|
| 1100 |
On this page