select ‘1‘ AS XQBH,to_char(trunc(to_date(‘2020-06-28‘ ,‘yyyy-mm-dd‘),‘iw‘),‘yyyy-mm-dd‘) AS RQ,‘星期一‘ as XQ
from dual
UNION ALL
select ‘2‘ AS XQBH,to_char(trunc(to_date(‘2020-06-30‘ ,‘yyyy-mm-dd‘),‘iw‘)+1,‘yyyy-mm-dd‘) AS RQ,‘星期二‘ as
XQ from dual
UNION ALL
select ‘3‘ AS XQBH,to_char(trunc(to_date(‘2020-06-28‘ ,‘yyyy-mm-dd‘),‘iw‘)+2,‘yyyy-mm-dd‘) AS RQ,‘星期三‘ as
XQ from dual
UNION ALL
select ‘4‘ AS XQBH,to_char(trunc(to_date(‘2020-06-30‘ ,‘yyyy-mm-dd‘),‘iw‘)+3,‘yyyy-mm-dd‘) AS RQ,‘星期四‘ as
XQ from dual
select ‘5‘ AS XQBH,to_char(trunc(to_date(‘2020-06-30‘ ,‘yyyy-mm-dd‘),‘iw‘)+1,‘yyyy-mm-dd‘) AS RQ,‘星期五‘ as
XQ from dual
UNION ALL
select ‘6‘ AS XQBH,to_char(trunc(to_date(‘2020-06-28‘ ,‘yyyy-mm-dd‘),‘iw‘)+2,‘yyyy-mm-dd‘) AS RQ,‘星期六‘ as
XQ from dual
UNION ALL
select ‘7‘ AS XQBH,to_char(trunc(to_date(‘2020-06-30‘ ,‘yyyy-mm-dd‘),‘iw‘)+3,‘yyyy-mm-dd‘) AS RQ,‘星期日‘ as
XQ from dual
如果其他参数,把上面的“2020-06-30”修改成自己的入参数就好,核心函数是trunc(sysydate,‘iw‘);iw是取到当前日期的周一!
oracle如何根据传入的时间参数,得到这个参数所在周的周一至周五的日期和星期数
标签:函数 参数 rac from 自己 har 核心 dual run
本条技术文章来源于互联网,如果无意侵犯您的权益请点击此处反馈版权投诉
本文系统来源:https://www.cnblogs.com/lzz1997/p/13067402.html