110個oracle常用函式總結 2

2022-08-12 03:18:18 字數 3203 閱讀 4821

21.返回乙個數字反余弦值

sql> select cosh(20) from dual;

cosh(20)

22.exp

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

sql> select exp(2),exp(1) from dual;

exp(2) exp(1)

7.3890561 2.7182818

23.floor

對給定的數字取整數

sql> select floor(2345.67) from dual;

floor(2345.67)

24.ln

返回乙個數字的對數值

sql> select ln(1),ln(2),ln(2.7182818) from dual;

ln(1) ln(2) ln(2.7182818)

0 .69314718 .99999999

25.log(n1,n2)

返回乙個以n1為底n2的對數

sql> select log(2,1),log(2,4) from dual;

log(2,1) log(2,4)

0 226.mod(n1,n2)

返回乙個n1除以n2的餘數

sql> select mod(10,3),mod(3,3),mod(2,3) from dual;

mod(10,3) mod(3,3) mod(2,3)

1 0 2

27.power

返回n1的n2次方根

sql> select power(2,10),power(3,3) from dual;

power(2,10) power(3,3)

1024 27

28.round和trunc

按照指定的精度進行捨入

sql> select round(55.5),round(-55.4),trunc(55.5),trunc(-55.5) from dual;

round(55.5) round(-55.4) trunc(55.5) trunc(-55.5)

56 -55 55 -55

29.sign取數字n的符號,大於0返回1,小於0返回-1,等於0返回0 sql> select sign(123),sign(-100),sign(0) from dual;

sign(123) sign(-100) sign(0)

1 -1 0

30.sin

返回乙個數字的正弦值

sql> select sin(1.57079) from dual;

sin(1.57079)

131.sigh

返回雙曲正弦的值

sql> select sin(20),sinh(20) from dual;

sin(20) sinh(20)

.91294525 242582598

32.sqrt

返回數字n的根

sql> select sqrt(64),sqrt(10) from dual;

sqrt(64) sqrt(10)

8 3.1622777

33.tan

返回數字的正切值

sql> select tan(20),tan(10) from dual;

tan(20) tan(10)

2.2371609 .64836083

34.tanh

返回數字n的雙曲正切值

sql> select tanh(20),tan(20) from dual;

tanh(20) tan(20)

1 2.2371609

35.trunc

按照指定的精度擷取乙個數

sql> select trunc(124.1666,-2) trunc1,trunc(124.16666,2) from dual;

trunc1 trunc(124.16666,2)

100 124.16

36.add_months

增加或減去月份

sql> select to_char(add_months(to_date(199912,yyyymm),2),yyyymm) from dual;

to_cha

sql> select to_char(add_months(to_date(199912,yyyymm),-2),yyyymm) from dual;

to_cha

37.last_day

返回日期的最後一天

sql> select to_char(sysdate,yyyy.mm.dd),to_char((sysdate)+1,yyyy.mm.dd) from dual;

to_char(sy to_char((s

2004.05.09 2004.05.10

sql> select last_day(sysdate) from dual;

last_day(s

31-5月-04

38.months_between(date2,date1)

給出date2-date1的月份

sql> select months_between(19-12月-1999,19-3月-1999) mon_between from dual;

mon_between

sql>selectmonths_between(to_date(2000.05.20,yyyy.mm.dd),to_date(2005.05.20,yyyy.mm.dd))

mon_betw from dual;

mon_betw

-6039.new_time(date,this,that)

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

sql> select to_char(sysdate,yyyy.mm.dd hh24:mi:ss) bj_time,to_char(new_time 2 (sysdate,pdt,gmt),yyyy.mm.dd hh24:mi:ss) los_angles from dual;

bj_time los_angles

2004.05.09 11:05:32 2004.05.09 18:05:32

40.next_day(date,day)

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

sql> select next_day('18-5月-2001','星期五') next_day from dual;

next_day

25-5月-01

MFC常用函式(總)for Myse

boolcopyfile lpctstr lpexistingfilename,pointer to name of an existing file lpctstr lpnewfilename,pointer to filename to copy to bool bfailifexists fl...

oracle中的add months 函式總結

oracle中的常用的函式的總結 1 add months x,y 或者add months times,months 函式 1 用途 這個函式用於計算在時間x之上機上y個月後的時間值,要是y的值為負數的話就是在 這個時間點之間的時間值 這個時間 y個月 2 用法例項 a 從emp表查詢列出來公司就...

Oracle常用函式

一 row number over 資料甲 1 select column name column name,data type,2 row number over partition by column name order by column name row num 3 from test c...