一句SQL寫出不包含星期六,星期天的一年的日期


--一年中除週六日外的日期
select to_char(ta,'yyyymmdd') from (select to_date('20141231','yyyymmdd') + level ta from dual connect by level<367) where to_char(ta,'d') not in (1,7) and ta <to_date('20160101','yyyymmdd')

--獲取當天是禮拜幾:
select to_char(sysdate,'d') from dual;  --禮拜天爲1,禮拜一爲2,類推 

--取當前時間的前十分鐘

select sysdate - 10/(60*24) from dual

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章