top of page



BIT_XOR(expr) [over_clause]

Returns the bitwise XOR of all bits in expr.

The result type depends on whether the function argument values are
evaluated as binary strings or numbers:

o Binary-string evaluation occurs when the argument values have a
binary string type, and the argument is not a hexadecimal literal,
bit literal, or NULL literal. Numeric evaluation occurs otherwise,
with argument value conversion to unsigned 64-bit integers as

o Binary-string evaluation produces a binary string of the same length
as the argument values. If argument values have unequal lengths, an
.html#error_er_invalid_bitwise_operands_size) error occurs. If the
argument size exceeds 511 bytes, an
.html#error_er_invalid_bitwise_aggregate_operands_size) error occurs.
Numeric evaluation produces an unsigned 64-bit integer.

If there are no matching rows, BIT_XOR() returns a neutral value (all
bits set to 0) having the same length as the argument values.

NULL values do not affect the result unless all values are NULL. In
that case, the result is a neutral value having the same length as the
argument values.

For more information discussion about argument evaluation and result
types, see the introductory discussion in

As of MySQL 8.0.12, this function executes as a window function if
over_clause is present. over_clause is as described in



bottom of page