Skip to main content

Categories: Bitwise

XOR

Returns the bitwise exclusive OR (XOR) of two INTEGER values. Only supports INTEGER inputs (use BITWISE_XOR for BIGINT). Returns NULL if any argument is NULL.

Syntax​

XOR(expression1 int32, expression2 int32) → int32​

  • expression1: The integer input.
  • expression2: The integer input.

Examples

XOR example
SELECT XOR(1, 1)
-- 0
Bitwise XOR of two integers
SELECT XOR(7, 4)
-- 3
XOR with a NULL argument
SELECT XOR(NULL, 1)
-- null