正在阅读:SQLServer和Oracle的常用函数对比SQLServer和Oracle的常用函数对比

2004-09-27 15:06 出处:CSDN 作者:jinjazz 责任编辑:linjixiong

  ---------数学函数

  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.取随机数
  S:select rand() value
  O:select sys.dbms_random.value(0,1) value from dual;

  13.取符号
  S:select sign(-8) value -1
  O:select sign(-8) value from dual -1


察看评论详细内容 我要发表评论
作者笔名简短内容 发表时间
:

键盘也能翻页,试试“← →”键

关注我们

最新资讯离线随时看 聊天吐槽赢奖品