bitxor
1. BITXOR Function
=======bitxor
1. BITXOR Function
>>>>>>> 9d19b1c8cb744c8e86d5c15b74d8b5f719ad62beThe BITXOR function in H2 database is used to perform a bitwise XOR operation on two integer values.
2. Syntax
The syntax for the BITXOR function in H2 database is as follows:
BITXOR(value1, value2)
Arguments
value1
: The first integer value for the bitwise XOR operation.value2
: The second integer value for the bitwise XOR operation.
Return
- The BITXOR function returns the result of the bitwise XOR operation on the two input values.
3. Notes
- The BITXOR function in H2 database only works with integer values.
- If either
value1
orvalue2
isNULL
, the result will also beNULL
. - The input values are treated as signed integers in the BITXOR operation.
- If the input values are not integers, they will be implicitly converted to integers before performing the bitwise XOR operation.
4. Examples
Here are a few examples demonstrating the usage of the BITXOR function in H2 database:
Example 1 - Performing a bitwise XOR operation on two integers:
SELECT BITXOR(10, 7) AS result;
Output:
result
------
13
Example 2 - Performing a bitwise XOR operation on two columns:
CREATE TABLE numbers (
id INT PRIMARY KEY,
value1 INT,
value2 INT
);
INSERT INTO numbers VALUES (1, 8, 3), (2, 5, 6), (3, 2, 2);
SELECT id, value1, value2, BITXOR(value1, value2) AS result
FROM numbers;
Output:
id | value1 | value2 | result
---+--------+--------+-------
1 | 8 | 3 | 11
2 | 5 | 6 | 3
3 | 2 | 2 | 0
5. Related Functions
There are no specific related functions for the BITXOR function in H2 database.