-- day_typ 0:工作日 1:休息日 2:节假日
insert into wkday
(wk_day, day_typ)
select wk_day,
case
when wk_day in ('20220101',
'20220102',
'20220103',
'20220131',
'20220201',
'20220202',
'20220203',
'20220204',
'20220205',
'20220206',
'20220403',
'20220404',
'20220405',
'20220430',
'20220501',
'20220502',
'20220503',
'20220504',
'20220603',
'20220604',
'20220605',
'20220910',
'20220911',
'20220912',
'20221001',
'20221002',
'20221003',
'20221004',
'20221005',
'20221006',
'20221007') then
'2'
when wk_day in ('20220129',
'20220130',
'20220402',
'20220424',
'20220507',
'20221008',
'20221009') then
'0'
else
day_typ
end day_typ
from (select wk_day,
case
when trim(to_char(to_date(wk_day, 'YYYYMMDD'), 'day')) in
('星期六', '星期日') then
'1'
else
'0'
end day_typ
from (select to_char(to_date('20220101', 'yyyyMMdd') + rownum - 1,
'yyyymmdd') as wk_day
from dual
connect by rownum <=
trunc(to_date('20221231', 'yyyyMMdd') -
to_date('20220101', 'yyyyMMdd')) + 1))
Oracle 数据库生成2022年节假日表SQL
最新推荐文章于 2022-07-16 16:11:09 发布