oracle 采购 日历,Oracle日历程序
運行之前要先設置好環境,即定義好年份:
DEFINE YEAR=&YEAR
要查看其它年份,就再執行:
def year=&year1
然后再執行下面的腳本:
select case
when (new_yweek = min(new_yweek)
over(partition by mon order by new_yweek)) then
mon_name
else
null
end as month,
new_yweek as yweek,
row_number() over(partition by mon order by new_yweek) as mweek,
sum(decode(wday, '1', mday, null)) as sun,
sum(decode(wday, '2', mday, null)) as mon,
sum(decode(wday, '3', mday, null)) as tue,
sum(decode(wday, '4', mday, null)) as wed,
sum(decode(wday, '5', mday, null)) as thu,
sum(decode(wday, '6', mday, null)) as fri,
sum(decode(wday, '7', mday, null)) as sat
from (select dayofyear as everyday,
to_char(dayofyear, 'mm') as mon,
to_char(dayofyear, 'Month') as mon_name,
to_char(dayofyear, 'w') as mweek,
to_char(dayofyear, 'ww') as yweek,
case
when (to_char(to_date(&year || '0101', 'yyyymmdd'), 'd') > '1') and
(to_char(dayofyear, 'd') <
to_char(to_date(&year || '0101', 'yyyymmdd'), 'd')) then
to_char(to_char(dayofyear, 'ww') + 1, 'fm00')
else
to_char(dayofyear, 'ww')
end as new_yweek,
to_char(dayofyear, 'd') as wday,
to_char(dayofyear, 'dd') as mday
from (select to_date(&year || '0101', 'yyyymmdd') + level - 1 as dayofyear
from dual
connect by level <=
to_char(to_date(&year || '1231', 'yyyymmdd'),
'ddd')))
group by mon, mon_name, new_yweek
總結
以上是生活随笔為你收集整理的oracle 采购 日历,Oracle日历程序的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 微笑、脱衣、挖洞 为什么被冻死的人会有如
- 下一篇: iPhone 14或提高全系售价?消息称