XORBITS()
This page is part of MariaDB's Documentation.
The parent of this page is: Functions for MariaDB Xpand
Topics on this page:
Overview
Returns a bitwise exclusive "or" of two numbers.
USAGE
XORBITS(number, number)
Argument Name | Description |
---|---|
| Two numbers to combine with bitwise exclusive "or" |
DETAILS
XORBITS()
is a bitwise function that performs a bitwise exclusive "or" of two numbers.
If you imagine each number in binary representation aligned by their least-significant bit, a bitwise "or" generates a 1
result bit for each pair of aligned bits that do not match each other.
The return value is the number representing the bit positions that differ in the two numbers.
A NULL
is returned if either argument is NULL
.
EXAMPLES
SELECT XORBITS(3, 5), XORBITS(1, 3), XORBITS(0, 7);
+---------------+---------------+---------------+
| XORBITS(3, 5) | XORBITS(1, 3) | XORBITS(0, 7) |
+---------------+---------------+---------------+
| 6 | 2 | 7 |
+---------------+---------------+---------------+