All Products
Search
Document Center

BITAND

Last Updated: Jun 18, 2021

The operator performs a bitwise AND operation. The input and output types are the NUMBER data type.

Syntax

BITAND (nExpression1, nExpression2)

Parameters

Parameter

Description

nExpression1, nExpression2

Specifies two numeric values for the bitwise AND operation. If nExpression1 and nExpression2 are not the integer type, they are converted to integers before the bitwise AND operation is performed.

Return type

NUMBER data type

Examples

a is 0100 in binary.

b is 0110 in binary.

Compare the binary numbers. If the digits in corresponding positions are all 1, the value of this bit is 1. Otherwise, the value is 0. Therefore, the result is BITAND(2 , 3) = 0100 = 2.

Execute the following statement:

SELECT BITAND(2,3) FROM DUAL;

The following query result is returned:

+-------------+
| BITAND(2,3) |
+-------------+
|           2 |
+-------------+