select to_char((CASE to_number(to_char(sysdate, 'D'))
WHEN 7 THEN
sysdate - 5
WHEN 6 THEN
sysdate - 4
WHEN 5 THEN
sysdate - 3
WHEN 4 THEN
sysdate - 2
WHEN 3 THEN
sysdate - 1
WHEN 2 THEN
sysdate
ELSE
sysdate - 6
END),
'yyyy-mm-dd') as zfastday,
to_char((CASE to_number(to_char(sysdate, 'D'))
WHEN 7 THEN
sysdate + 1
WHEN 6 THEN
sysdate + 2
WHEN 5 THEN
sysdate + 3
WHEN 4 THEN
sysdate + 4
WHEN 3 THEN
sysdate + 5
WHEN 2 THEN
sysdate + 6
ELSE
sysdate
END),
'yyyy-mm-dd') as zlastday,
to_char(trunc(add_months(last_day(sysdate), -1) + 1),
'yyyy-mm-dd') as fastday,
to_char(last_day(sysdate), 'yyyy-mm-dd') as lastday
from dual
查询当周以及当月的日期
最新推荐文章于 2024-09-09 11:35:27 发布