# PLSQL | BITAND Function

The **BITAND** is an inbuilt function in PLSQL which is used to returns an integer value which is calculated with AND operation of two given input decimal number. Internally these input decimal numbers get converted into binary numbers and then AND operation is performed and results are returned as output.

**Syntax:**

BITAND(num1, num2)

**Parameters Used:**

This function is accepting two parameters which are **num1** and **num2**. These two parameters are input decimal number which get converted into binary number internally and on which BITAND function is called.

**Return Value:**

This function returns an integer value which is calculated with BIT wise AND operation of two given input decimal number.

**Supported Versions of Oracle/PLSQL is given below:**

- Oracle 12c
- Oracle 11g
- Oracle 10g
- Oracle 9i
- Oracle 8i

Let’s see some examples which will illustrate the BITAND function:

**Example-1:**

DECLARE Test_Number number1 := 5; Test_Number number2 := 3; BEGIN dbms_output.put_line(BITAND(Test_Number number1, Test_Number number2)); END;

**Output:**

1

Here two numbers 5 and 3 are taken as the parameter. These two decimal numbers get converted into the binary equivalent. Binary equivalent of 5 and 3 are 101 and 011 respectively. Later this two binary number goes under AND operation and gives a new binary number 001 whose decimal equivalent is 1 and hence 1 is returned as output.

**Example-2:**

DECLARE Test_Number number1 := 5; Test_Number number2 := 0; BEGIN dbms_output.put_line(BITAND(Test_Number number1, Test_Number number2)); END;

**Output:**

0

Here two numbers 5 and 0 are taken as the parameter. These two decimal numbers get converted into the binary equivalent. Binary equivalent of 5 and 0 are 101 and 000 respectively. Later this two binary number goes under AND operation and gives a new binary number 000 whose decimal equivalent is 0 and hence 0 is returned as output.

**Advantage:**

This function is used to calculate BIT wise AND operation for the two given input decimal numbers.

## Recommended Posts:

- PLSQL | MOD Function
- PLSQL | COS Function
- PLSQL | LN Function
- PLSQL | LEAST Function
- PLSQL | SIN Function
- PLSQL | EXP Function
- PLSQL | ABS Function
- PLSQL | LOG Function
- PLSQL | TAN Function
- PLSQL | CHR Function
- PLSQL | EXTRACT Function
- PLSQL | UPPER Function
- PLSQL | DBTIMEZONE Function
- PLSQL | COSH Function
- PLSQL | LENGTH4 Function

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.