how can i set loop in pl/sql query function which the result of each loop out put in different columns and all in one table.
the function is :
select t1.aaa, coalesce(t2.bbb_count, 0) bbb_count,
coalesce(t2.ccc_sum, 0) ccc_sum
from (
select distinct aaa
from nrb
) t1
left join (
select t.aaa, count (t.bbb) bbb_count, sum (t.ccc) ccc_sum
from nrb t
where t.vvv IN ('3','4','5','6','D','E','F')
and t.ddd like '50%'
and t.eee >= TO_DATE('2012/03/21','YYYY/MM/DD')
and t.eee <= TO_DATE('2012/07/21','YYYY/MM/DD')
group by t.aaa
) t2 on t1.aaa = t2.aaa
order by t1.aaa;
this function will give me a table with 200 rows and 3 columns. i need to make a loop in
” and t.ddd like ‘50%'”
line , from 50 to 55. i mean the result will be 200 rows and 15 columns.
Pl/sql 7.0.2 unlimited user lisence
oci : 9.2
oracle db : 11.1.0.6.0 enterprise
os : win xp
1 Answer