BITWISE_NOT()

All functions > BITWISE > BITWISE_NOT()

Returns the bitwise NOT (complement) of a bitstring, flipping every bit.

Signatures

Returns: Bitwise complement, or NULL if the input is NULL

BITWISE_NOT(expr: BITSTRING) → BITSTRING
sql
ParameterTypeRequiredDescription
exprBITSTRINGYesInput bitstring

Notes

  • Every 0 becomes 1 and every 1 becomes 0
  • The length of the result is the same as the input
  • Returns NULL if the input is NULL

Related operators

Examples

FeatureQL
SELECT
    f1 := BITWISE_NOT('1010'::BITSTRING)::VARCHAR -- Flip all bits
;
Result
f1 VARCHAR
0101

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