bitnot
1. BITNOT Function
=======bitnot
1. BITNOT Function
>>>>>>> 9d19b1c8cb744c8e86d5c15b74d8b5f719ad62beThe BITNOT function in H2 database is used to perform a bitwise NOT operation on a given integer value.
2. Syntax
The syntax for the BITNOT function in H2 database is as follows:
BITNOT(value)
Arguments
value
: The integer value on which the bitwise NOT operation needs to be performed.
Return
- The BITNOT function returns the result of the bitwise NOT operation as an integer value.
3. Notes
- The BITNOT function in H2 database expects the input value to be an integer. If the value is not an integer, it will be implicitly converted to an integer before performing the bitwise NOT operation.
- The bitwise NOT operation inverts each bit of the input value, resulting in a bitwise complement.
4. Examples
Here are a few examples demonstrating the usage of the BITNOT function in H2 database:
Example 1 - Performing bitwise NOT on an integer value:
SELECT BITNOT(5) AS result;
Output:
result
------
-6
Example 2 - Performing bitwise NOT on a column:
CREATE TABLE numbers (
id INT PRIMARY KEY,
value INT
);
INSERT INTO numbers VALUES (1, 10), (2, 15), (3, 7);
SELECT id, value, BITNOT(value) AS result
FROM numbers;
Output:
id | value | result
---+-------+--------
1 | 10 | -11
2 | 15 | -16
3 | 7 | -8