查询一年内所有双休日

首先得到年头年尾日期
select to_date('2020-01-01', 'yyyy-mm-dd') into v_start from dual;
select to_date('2020-12-31', 'yyyy-mm-dd') into v_end from dual;
循环
WHILE(v_end>=v_start)
LOOP
select to_char(v_start,'d') into v_day from dual;
if v_day='1' or v_day='7' then --周六或者周日

		--执行操作
	      
		end if;
				
		v_start := v_start + 1;   
      END LOOP; 
posted @ 2021-01-21 17:00  BengBaLaHei  阅读(109)  评论(0)    收藏  举报