|
select
max(decode(mod(a.a_num,7),1,decode(a.b_num,null,''||a.a_num,'['||a.a_n
um||']'))) as col1,
max(decode(mod(a.a_num,7),2,decode(a.b_num,null,''||a.a_num,'['||a.a_n
um||']'))) as col2,
max(decode(mod(a.a_num,7),3,decode(a.b_num,null,''||a.a_num,'['||a.a_n
um||']'))) as col3,
max(decode(mod(a.a_num,7),4,decode(a.b_num,null,''||a.a_num,'['||a.a_n
um||']'))) as col4,
max(decode(mod(a.a_num,7),5,decode(a.b_num,null,''||a.a_num,'['||a.a_n
um||']'))) as col5,
max(decode(mod(a.a_num,7),6,decode(a.b_num,null,''||a.a_num,'['||a.a_n
um||']'))) as col6,
max(decode(mod(a.a_num,7),0,decode(a.b_num,null,''||a.a_num,'['||a.a_n
um||']'))) as col7
from (
select
ceil((a.rnum)/7) as id,
a.rnum as a_num,
b.rnum as b_num
from
(select rownum as rnum from dual connect by level<=45) a
left outer join
(
select
*
from (
select
rownum as rnum,
dbms_random.value(1,1000000000000) as rval
from dual
connect by level<=45
order by rval desc
)
where rownum<=6
order by rnum) b
on a.rnum=b.rnum
order by a.rnum
)a
group by a.id
|