BITAND [message #58691] |
Thu, 25 September 2003 21:29 |
Sujit Sarkar
Messages: 40 Registered: September 2003
|
Member |
|
|
can anyone help me with simple example to understand the use of BITAND function.I have seen the heavy use of this function specially with dictionary tables.
I really need the respone quickly
thanx in advance
Sujit
|
|
|
Re: BITAND [message #58699 is a reply to message #58691] |
Fri, 26 September 2003 05:41 |
Thiru
Messages: 1089 Registered: May 2002
|
Senior Member |
|
|
It simply does a bitwise AND between the supplied arguments.
The bits in the integer are represented in the powers of 2 as follows :
128 64 32 16 8 4 2 1
----------------------
1 = 0 0 0 0 0 0 0 1
2 = 0 0 0 0 0 0 1 0
3 = 0 0 0 0 0 0 1 1
and so on ...
AND returns TRUE only if BOTH the arguments evaluates to true(ie 1) . ie
1 AND 0 = 0
1 AND 1 = 1
0 AND 0 = 0
and so
SQL> select bitand(1,3) from dual;
BITAND(1,3)
-----------
1
becos 1 = 0 1
3 = 1 1
bitand = 0 1 = 1
Thats all there is to it .
HTH
Thiru
|
|
|