<<<<<<< HEAD bitxor | H2 | SQLDoc
Skip to main content

bitxor

1. BITXOR Function

======= bitxor | H2 Function | SQLDoc

bitxor

1. BITXOR Function

>>>>>>> 9d19b1c8cb744c8e86d5c15b74d8b5f719ad62be

The 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 or value2 is NULL, the result will also be NULL.
  • 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

There are no specific related functions for the BITXOR function in H2 database.