Áï, Ãâ·ÂÀº µÎ ÀÔ·ÂÀÇ bitwise ANDÀÌ´Ù.
expr1, expr2ÀÇ µ¥ÀÌÅÍŸÀÔÀº NUMBERÀ̰í, Ãâ·Âµµ NUMBER µ¥ÀÌÅÍŸÀÔÀÌ´Ù.
¶ÇÇÑ µÎ ÀÔ·ÂÀÌ NULLÀ̸é, Ãâ·Âµµ NULLÀÌ´Ù.
µÎ ¾Æ±Ô¸ÕÆ®ÀÇ ¹üÀ§´Â -2(n-1)∼(2(2-1) - 1)À̸ç, Ãâ·ÂÀÇ ¹üÀ§´Â Á¤ÇØÁöÁö ¾Ê¾Ò´Ù.
BITANDÀÇ ÁÖÀÇ»çÇ×
¡¼Çü½Ä¡½
BITAND(expr1, expr2)
¡¼¿¹Á¦¡½
SQL> select bitand(101,100),bitand(1010,1100),
2 bitand(1010,0011),bitand(1110,1110) from dual;
BITAND(101,100) BITAND(1010,1100) BITAND(1010,0011) BITAND(1110,1110)
--------------- ----------------- ----------------- -----------------
100 64 2 1110
SQL> select bitand(6,3) from dual;¢Ð 6=110, 3=011
BITAND(6,3)
-----------
2
SQL> select bitand(
2 bin_to_num(1,1,0),
3 bin_to_num(0,1,1)) "Binary" from dual;
Binary
----------
2
SQL> conn oe/oe
Connected.
SQL> select order_id, customer_id, order_status,
2 DECODE(BITAND(order_status,1), 1, 'Warehouse', 'postoffice')
3 "Location",
4 decode(bitand(order_status,2), 2, 'Ground','Air') "Method",
5 decode(bitand(order_status,4), 4, 'Insured', 'Certified') "Receipt"
6 from orders
7 where sales_rep_id = 160
8 order by order_id;
ORDER_ID CUSTOMER_ID ORDER_STATUS Location Method Receipt
---------- ----------- ------------ ---------- ---------- ------------
2416 104 6 postoffice Ground Insured
2419 107 3 Warehouse Ground Certified
2420 108 2 postoffice Ground Certified
2423 145 3 Warehouse Ground Certified
2441 106 7 Warehouse Ground Insured
2455 145 7 Warehouse Ground Insured
6 rows selected.
SQL>