Oracle數學函數和SQL Server中的數學函數不太一樣。下面就為您詳細介紹Oracle數學函數和SQL Server中的數學函數的區別,希望對您有所幫助。
①絕對值
S:select abs(-1) value
O:select abs(-1) value from dual
②取整(大)
S:select ceiling(-001) value
O:select ceil(-001) value from dual
③取整(小)
S:select floor(-001) value
O:select floor(-001) value from dual
④取整(截取)
S:select cast(-002 as int) value
O:select trunc(-002) value from dual
⑤四捨五入
S:select round(23456,4) value 23460
O:select round(23456,4) value from dual 2346
⑥e為底的冪
S:select Exp(1) value
O:select Exp(1) value from dual
⑦取e為底的對數
S:select log(7182818284590451) value
O:select ln(7182818284590451) value from dual;
⑧取10為底對數
S:select log10(10) value
O:select log(10,10) value from dual;
⑨取平方
S:select SQUARE(4) value
O:select power(4,2) value from dual
⑩取平方根
S:select SQRT(4) value
O:select SQRT(4) value from dual
求任意數為底的冪
S:select power(3,4) value
O:select power(3,4) value from dual
取隨機數
S:select rand() value
O:select sys.dbms_random.value(0,1) value from dual;
取符號
S:select sign(-8) value -1
O:select sign(-8) value from dual -1
以上就是Oracle數學函數和SQL數學函數的區別介紹。