Skip to main content

Categories: Bitwise

BITWISE_NOT

Returns the bitwise NOT of the input value by inverting all of its bits. Returns the same type as the input (INT for INT, BIGINT for BIGINT). Returns NULL if the argument is NULL.

Syntax​

BITWISE_NOT(op1 NUMERIC) → NUMERIC​

  • op1: An INTEGER or BIGINT expression.

Examples

BITWISE_NOT example
SELECT BITWISE_NOT(0)
-- -1
BITWISE_NOT example
SELECT BITWISE_NOT(9223372036854775807)
-- -9223372036854775808
BITWISE_NOT with a NULL argument
SELECT BITWISE_NOT(NULL)
-- null