oracle 函数 bitand 与 decode

1.bitand()函数

学习链接https://blog.csdn.net/sread/article/details/9971471?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-5.nonecase&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-5.nonecase

=》比较该二进制  若相对应的位置都为1  则为 1  其余为0 =》同为真怎为真,运用判断是否含有相同数

bitand(5,6)->4 bitand(9,10)->8

2.decode

DECODE(value,if 条件1,then 值1,if 条件2,then 值2,...,else 其他值)

Select decode(sign(var1-var2),1,var1,var2) from dual

Sign()函数根据某个值是0、正数、负数,分别返回0、1、-1;

Sql测试:

Select decode(sign(100-60),1,'及格','不及格') from dual;  --分数是否大于60分 

猜你喜欢

转载自www.cnblogs.com/Spring-Rain/p/12897842.html