摘要: 由于存在不是整周,和起始日期,终止日期星期不定的复杂情况,所以简单的sql语句貌似无法实现.写个函数,从起始日期开始,判断不是周末的话就加1天,只到终止日期.create or replace function day_count(t1 date,t2 date) return numberis n number:=0;tt date;begin tt:=t1; while tt<=t2 loop n:=n+(case when to_char(tt,'day') in('星期六','星期日') then 0 else 1 end); tt 阅读全文
posted @ 2014-02-13 16:49 lonsine 阅读(988) 评论(0) 推荐(0) 编辑