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

bitor

1. BITOR Function

======= bitor | H2 Function | SQLDoc

bitor

1. BITOR Function

>>>>>>> 9d19b1c8cb744c8e86d5c15b74d8b5f719ad62be

The BITOR function in H2 database is used to perform a bitwise OR operation on two integer values.

2. Syntax

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

BITOR(value1, value2)

Arguments

  • value1, value2: The integer values on which the bitwise OR operation needs to be performed.

Return

  • The BITOR function returns the result of the bitwise OR operation on value1 and value2.

3. Notes

  • The BITOR function in H2 database performs the bitwise OR operation on the binary representations of the input values.
  • If either value1 or value2 is not an integer, it will be implicitly cast to an integer before the operation.
  • The result of the BITOR operation will be an integer value.

4. Examples

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

Example 1 - Performing a bitwise OR operation on two values:

SELECT BITOR(5, 3) AS result;

Output:

result
------
7

Example 2 - Performing a bitwise OR 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, 9), (3, 3, 3);

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

Output:

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