selecthtml
T31267.CREATED_DATE as F31265,git
(select to_char(to_date(T31267.CREATED_DATE,'yyyy-mm-dd'),'yyyyiw') from dual) as weekoracle
from LEAP.HMDM_DM_DLR_CLUE T31267函數
總結:post
from dualspa
ww | Same day of the week as the first day of the year | 按年度1月1日的第一天爲每週第一天 |
iw | Same day of the week as the first day of the ISO week, which is Monday | 每週一 |
w | Same day of the week as the first day of the month | 按月份1日的第一天做爲每週第一天 |
TRUNC(number,num_digits)
Number 須要截尾取整的數字。
Num_digits 用於指定取整精度的數字。Num_digits 的默認值爲 0。若是Num_digits爲正數,則截取小數點後Num_digits位;若是爲負數,則先保留整數部分,而後從個位開始向前數,並將遇到的數字都變爲0。
TRUNC()函數在截取時不進行四捨五入,直接截取。.net
針對數字的案例,如:htm
select trunc(123.458) from dual --123ci
select trunc(123.458,0) from dual --123it
select trunc(123.458,1) from dual --123.4
select trunc(123.458,-1) from dual --120
select trunc(123.458,-4) from dual --0
select trunc(123.458,4) from dual --123.458
select trunc(123) from dual --123
select trunc(123,1) from dual --123
select trunc(123,-1) from dual --120
針對日期的案例,如:
select trunc(sysdate) from dual --2017/6/13 返回當天的日期
select trunc(sysdate,'yyyy') from dual --2017/1/1 返回當年第一天.
select trunc(sysdate,'mm') from dual --2017/6/1 返回當月第一天.
select trunc(sysdate,'d') from dual --2017/6/11 返回當前星期的第一天(以週日爲第一天).
select trunc(sysdate,'dd') from dual --2017/6/13 返回當前年月日
select trunc(sysdate,'hh') from dual --2017/6/13 13:00:00 返回當前小時
select trunc(sysdate,'mi') from dual --2017/6/13 13:06:00 返回當前分鐘
其餘優秀連接推薦:
https://www.2cto.com/database/201302/191827.htmlhttps://www.oschina.net/question/44870_3710