Updated on 2026-11-06 GMT+08:00

BITNOT

Syntax

INT BITNOT(INT number)

Description

The BITNOT function is used to perform a bitwise NOT operation. The bitwise NOT operation inverts the binary bits of an integer, that is, 0 becomes 1 and 1 becomes 0. Because the INT type uses two's complement representation, the result after inversion must be understood according to the two's complement rules.

Input Parameters

Parameter

Data Type

number

INT

Example

CREATE TABLE source (
  f_sequence INT
) WITH (
  'connector' = 'datagen',
  'rows-per-second' = '1'
);
CREATE TABLE print with(
'connector' = 'print'
) as select
  BITNOT (7) as int1
from source;

The returned result is -8, and the data type is INT.