熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> Oracle >> 正文

110個oracle常用函數總結(2)

2022-06-13   來源: Oracle 

  返回一個數字反余弦值

  SQL> select cosh() from dual;

  COSH()

  

  

  EXP

  返回一個數字e的n次方根

  SQL> select exp()exp() from dual;

  EXP() EXP()

  

  

  FLOOR

  對給定的數字取整數

  SQL> select floor() from dual;

  FLOOR()

  

  

  LN

  返回一個數字的對數值

  SQL> select ln()ln()ln() from dual;

  LN() LN() LN()

  

  

  LOG(nn)

  返回一個以n為底n的對數

  SQL> select log()log() from dual;

  LOG() LOG()

  

  

  MOD(nn)

  返回一個n除以n的余數

  SQL> select mod()mod()mod() from dual;

  MOD() MOD() MOD()

  

  

  POWER

  返回n的n次方根

  SQL> select power()power() from dual;

  POWER() POWER()

  

  

  ROUND和TRUNC

  按照指定的精度進行捨入

  SQL> select round()round()trunc()trunc() from dual;

  ROUND() ROUND() TRUNC() TRUNC()

  

  

  SIGN取數字n的符號大於返回小於返回等於返回 SQL> select sign()sign()sign() from dual;

  SIGN() SIGN() SIGN()

  

  

  SIN

  返回一個數字的正弦值

  SQL> select sin() from dual;

  SIN()

  

  

  SIGH

  返回雙曲正弦的值

  SQL> select sin()sinh() from dual;

  SIN() SINH()

  

  

  SQRT

  返回數字n的根

  SQL> select sqrt()sqrt() from dual;

  SQRT() SQRT()

  

  

  TAN

  返回數字的正切值

  SQL> select tan()tan() from dual;

  TAN() TAN()

  

  

  TANH

  返回數字n的雙曲正切值

  SQL> select tanh()tan() from dual;

  TANH() TAN()

  

  

  TRUNC

  按照指定的精度截取一個數

  SQL> select trunc() trunctrunc() from dual;

  TRUNC TRUNC()

  

  

  ADD_MONTHS

  增加或減去月份

  SQL> select to_char(add_months(to_date(yyyymm))yyyymm) from dual;

  TO_CHA

  

  

  SQL> select to_char(add_months(to_date(yyyymm))yyyymm) from dual;

  TO_CHA

  

  

  LAST_DAY

  返回日期的最後一天

  SQL> select to_char(sysdateyyyymmdd)to_char((sysdate)+yyyymmdd) from dual;

  TO_CHAR(SY TO_CHAR((S

  

  

  SQL> select last_day(sysdate) from dual;

  LAST_DAY(S

  

  

  MONTHS_BETWEEN(datedate)

  給出datedate的月份

  SQL> select months_between() mon_between from dual;

  MON_BETWEEN

  

  

  SQL>selectmonths_between(to_date(yyyymmdd)to_date(yyyymmdd))

  mon_betw from dual;

  MON_BETW

  

  

  NEW_TIME(datethisthat)

  給出在this時區=other時區的日期和時間

  SQL> select to_char(sysdateyyyymmdd hh:mi:ss) bj_timeto_char(new_time (sysdatePDTGMT)yyyymmdd hh:mi:ss) los_angles from dual;

  BJ_TIME LOS_ANGLES

  

   :: ::

  NEXT_DAY(dateday)

  給出日期date和星期x之後計算下一個星期的日期

  SQL> select next_day(星期五) next_day from dual;

  NEXT_DAY

  

  


From:http://tw.wingwit.com/Article/program/Oracle/201311/17388.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.