SQL和ORACLE函数比较
2008-09-08 12:53:49 来源:WEB开发网SQLServer和Oracle是大家经常用到的数据库,在此感谢作者总结出这些常用函数以供大家参考。
数学函数:
1.绝对值
S:SELECT abs(-1) value
O:SELECT abs(-1) value from dual
2.取整(大)
S:SELECT ceiling(-1.001) value
O:SELECT ceil(-1.001) value from dual
3.取整(小)
S:SELECT floor(-1.001) value
O:SELECT floor(-1.001) value from dual
4.取整(截取)
S:SELECT cast(-1.002 as int) value
O:SELECT trunc(-1.002) value from dual
5.四舍五入
S:SELECT round(1.23456,4) value 1.23460
O:SELECT round(1.23456,4) value from dual 1.2346
6.e为底的幂
S:SELECT Exp(1) value 2.7182818284590451
O:SELECT Exp(1) value from dual 2.71828182
7.取e为底的对数
S:SELECT log(2.7182818284590451) value 1
O:SELECT ln(2.7182818284590451) value from dual; 1
8.取10为底对数
S:SELECT log10(10) value 1
O:SELECT log(10,10) value from dual; 1
9.取平方
S:SELECT SQUARE(4) value 16
O:SELECT power(4,2) value from dual 16
10.取平方根
S:SELECT SQRT(4) value 2
O:SELECT SQRT(4) value from dual 2
11.求任意数为底的幂
S:SELECT power(3,4) value 81
O:SELECT power(3,4) value from dual 81
12.取随机数
更多精彩
赞助商链接