欧美一区二区三区,国内熟女精品熟女A片视频小说,日本av网,小鲜肉男男GAY做受XXX网站

oracle中如何將年周例如1502轉換為年月日20150105

吉茹定2年前21瀏覽0評論

oracle中如何將年周例如1502轉換為年月日20150105?

思路:先獲取年份和周數,然后獲取該年第一天是周幾, 然后獲取該年第一周的開始時間,然后加上(周數-1)*7,例子

with tmp as (select '1502' as a from dual union all select '1503' as a from dual union all select '1402' as a from dual union all select '0701' as a from dual)select a, to_char(years - w + (weeks - 1) * 7,'yyyymmdd') as begin_week from (select a, years, weeks, --因為oracle 的周是從周日開始,星期一是2 to_char(years, 'd') - 2 as w from (select a, to_date('20' || substr(a, 1, 2) || '-01-01', 'yyyy-mm-dd') as years, substr(a, -2, 2) as weeks from tmp))