分享一下我老师大神的人工智能教程!零基础,通俗易懂!http://blog.csdn.net/jiangjunshow
也欢迎大家转载本篇文章。分享知识,造福人民,实现我们中华民族伟大复兴!
1、获取当天是礼拜几:select to_char(sysdate,'d') from dual; --礼拜天为1,礼拜一为2,类推2、获取 两个时间段间的 工作日:select (trunc(&end_dt - &start_dt) - ((case WHEN (8 - to_number(to_char(&start_dt,'D'))) > trunc(&end_dt - &start_dt) + 1 THEN 0 ELSE trunc((trunc(&end_dt - &start_dt) - (8 - to_number(to_char(&start_dt,'D'))))/7) + 1 END) + (case WHEN mod(8 - to_char(&start_dt, 'D'), 7) > trunc(&end_dt - &start_dt) - 1 THEN 0 ELSE trunc((trunc(&end_dt - &start_dt) - (mod(8 - to_char(&start_dt,'D'),7) + 1))/7) + 1 END))) as workingdays from dual下面的sql可以直接运行:select (trunc(to_date('2010-11-11','yyyy-mm-dd') - to_date('2010-11-07','yyyy-mm-dd')) - ((case WHEN (8 - to_number(to_char(to_date('2010-11-07','yyyy-mm-dd'),'D'))) > trunc(to_date('2010-11-11','yyyy-mm-dd') - to_date('2010-11-07','yyyy-mm-dd')) + 1 THEN 0 ELSE trunc((trunc(to_date('2010-11-11','yyyy-mm-dd') - to_date('2010-11-07','yyyy-mm-dd')) - (8 - to_number(to_char(to_date('2010-11-07','yyyy-mm-dd'),'D'))))/7) + 1 END) + (case WHEN mod(8 - to_char(to_date('2010-11-07','yyyy-mm-dd'), 'D'), 7) > trunc(to_date('2010-11-11','yyyy-mm-dd') - to_date('2010-11-07','yyyy-mm-dd')) - 1 THEN 0 ELSE trunc((trunc(to_date('2010-11-11','yyyy-mm-dd') - to_date('2010-11-07','yyyy-mm-dd')) - (mod(8 - to_char(to_date('2010-11-07','yyyy-mm-dd'),'D'),7) + 1))/7) + 1 END))) as workingdays from dual
给我老师的人工智能教程打call!http://blog.csdn.net/jiangjunshow
![这里写图片描述](https://i-blog.csdnimg.cn/blog_migrate/2e19ffb3303a490d20ea5d00dd397156.gif)