select
max
(decode(
mod
(n,
7
),
0
, m,
null
))
日
,
max
(decode(
mod
(n,
7
),
1
, m,
null
))
一
,
max
(decode(
mod
(n,
7
),
2
, m,
null
))
二
,
max
(decode(
mod
(n,
7
),
3
, m,
null
))
三
,
max
(decode(
mod
(n,
7
),
4
, m,
null
))
四
,
max
(decode(
mod
(n,
7
),
5
, m,
null
))
五
,
max
(decode(
mod
(n,
7
),
6
, m,
null
))
六
from
(
select
rownum
m,
rownum
+ to_char(trunc(
sysdate
,
'mm'
),
'd'
) -
2
n
from
dual
connect
by
rownum
< = to_char(last_day(
sysdate
),
'dd'
))
group
by
trunc(n /
7
)
order
by
trunc(n /
7
);