请问:Oracle PL/sql中有没有位操作的函数

[复制链接]
查看11 | 回复3 | 2005-2-28 12:57:00 | 显示全部楼层 |阅读模式
请问:Oracle PL/sql中有没有位操作的函数
回复

使用道具 举报

千问 | 2005-2-28 12:57:00 | 显示全部楼层
UP
回复

使用道具 举报

千问 | 2005-2-28 12:57:00 | 显示全部楼层
http://asktom.oracle.com/pls/ask ... TERIA:272815731791,
The easiest is to use an undocumented (but heavily used -- check out the data
dictionary views, they use it all over the place so it won't be going away
anytime soon) function BITAND().Consider:
[email protected]> declare
2nnumber;
3begin
4n := random.rand_max( power(2,31) );
5
5dbms_output.put_line( 'Number is ' || n ||
6
' ' || to_bin(n) );
7for j in 0 .. 30 loop
8
dbms_output.put( 'The ' || to_char(j+1) ||
9
'''th bit is ' );
10
if ( bitand( n, power(2,j) ) = power(2,j) )
11
then
12
dbms_output.put_line( 'on' );
13
else
14
dbms_output.put_line( 'off' );
15
end if;
16end loop;
17end;
18/
回复

使用道具 举报

千问 | 2005-2-28 12:57:00 | 显示全部楼层
http://www.itpub.net/showthread.php?s=&threadid=253150
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行