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