BIT_NOT

All functions > BITWISE > BIT_NOT

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

Signatures

Returns: Bitwise complement with all bits flipped

BIT_NOT(bitstring: BITSTRING) → BITSTRING
sql
ParameterTypeRequiredDescription
bitstringBITSTRINGYesBitstring to invert

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

Examples

FeatureQL
SELECT
    f1 := BIT_NOT('1010'::BITSTRING)::VARCHAR,  -- Flip all bits
    f2 := BIT_NOT('0000'::BITSTRING)::VARCHAR,  -- All zeros become all ones
    f3 := BIT_NOT('1111'::BITSTRING)::VARCHAR  -- All ones become all zeros
;
Result
f1 VARCHARf2 VARCHARf3 VARCHAR
010111110000

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