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

bitxnor

1. BITXNOR Function

======= bitxnor | H2 Function | SQLDoc

bitxnor

1. BITXNOR Function

>>>>>>> 9d19b1c8cb744c8e86d5c15b74d8b5f719ad62be

The BITXNOR function in H2 database is used to perform a bitwise logical XNOR operation on two integer values.

2. Syntax

The syntax for the BITXNOR function in H2 database is as follows:

BITXNOR(value1, value2)

Arguments

  • value1: The first integer value.
  • value2: The second integer value.

Return

  • The BITXNOR function returns the result of the bitwise logical XNOR operation on the two input values.

3. Notes

  • The BITXNOR function in H2 database performs the XNOR operation on the corresponding bits of the two input values. It returns a value where each bit is 1 if the corresponding bits of both values are the same, and 0 otherwise.
  • The input values are treated as 32-bit signed integers by default. If you want to perform the operation on larger values, you can use the BIGINT datatype.
  • If either of the input values is NULL, the BITXNOR function will return NULL.

4. Examples

Here are a few examples demonstrating the usage of the BITXNOR function in H2 database:

Example 1 - Performing a bitwise XNOR operation on two integers:

SELECT BITXNOR(5, 3) AS result;

Output:

result
------
2

Example 2 - Performing a bitwise XNOR operation on values stored in columns:

CREATE TABLE numbers (
id INT PRIMARY KEY,
value1 INT,
value2 INT
);

INSERT INTO numbers VALUES (1, 10, 5), (2, 7, 7), (3, 0, 2);

SELECT id, value1, value2, BITXNOR(value1, value2) AS result
FROM numbers;

Output:

id | value1 | value2 | result
---+--------+--------+-------
1 | 10 | 5 | 15
2 | 7 | 7 | 0
3 | 0 | 2 | 1
  • bitand - Perform bitwise AND operation
  • bitor - Perform bitwise OR operation
  • bitxor - Perform bitwise XOR operation