bitnor
1. BITNOR Function
=======bitnor
1. BITNOR Function
>>>>>>> 9d19b1c8cb744c8e86d5c15b74d8b5f719ad62beThe BITNOR function in H2 database performs a bitwise NOT operation on a given integer.
2. Syntax
The syntax for the BITNOR function in H2 database is as follows:
BITNOR(value)
Arguments
value
: The integer for which the bitwise NOT operation needs to be performed. It should be a numeric value.
Return
- The BITNOR function returns the result of the bitwise NOT operation on the given integer.
3. Notes
- The BITNOR function in H2 database expects the input value to be an integer. If the value is not an integer or exceeds the numeric range, the function will return
NULL
. - The BITNOR function performs a bitwise NOT operation on the binary representation of the input value. It flips all the bits from 0 to 1 and vice versa.
- Remember to use the correct syntax and datatype while using the BITNOR function to avoid errors.
4. Examples
Here are a few examples demonstrating the usage of the BITNOR function in H2 database:
Example 1 - Performing bitwise NOT on an integer:
SELECT BITNOR(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, 7), (2, 10), (3, 15);
SELECT id, value, BITNOR(value) AS result
FROM numbers;
Output:
id | value | result
---+-------+--------
1 | 7 | -8
2 | 10 | -11
3 | 15 | -16