BITAND
BITAND(n1, n2)
Section titled “BITAND(n1, n2)”- n1: This is the first binary number for the BITAND operation. It must be a non-negative integer or a value that can be implicitly converted to an integer.
- n2: This is the second binary number for the BITAND operation. Similar to n1, it must be a non-negative integer or a value that can implicitly be converted to an integer.
Example
Section titled “Example”SELECT BITAND(15, 10) as Result FROM dual;Output
Section titled “Output”RESULT------10Explanation
Section titled “Explanation”The BITAND function performs a bitwise AND operation between the binary representations of the two numbers. In this case, numbers 15 (1111 in binary) and 10 (1010 in binary) are compared. The resulting number is 10 (1010 in binary), because the AND operation results in 1 for each bit where both input bits are 1.
BITAND(bigint, bigint) RETURNS bigint
Section titled “BITAND(bigint, bigint) RETURNS bigint”- bigint: This is the first parameter of the BITAND function. It represents the first large binary integer on which the bitwise AND operation will be performed.
- bigint: This is the second parameter of the BITAND function. It represents the second large binary integer on which the bitwise AND operation will be performed.
- returns bigint: This indicates that the BITAND function will return a result of type large binary integer, which is the result of the bitwise AND operation carried out on the two input parameters.
Example
Section titled “Example”SELECT BIT_AND(6, 3);Output
Section titled “Output”2Explanation
Section titled “Explanation”The BIT_AND() function performs a bitwise AND operation between the bits of the two numbers. In the example, the numbers 6 (binary 110) and 3 (binary 011) were used. The bitwise AND operation results in the number 2 (binary 010).