我的程序块如下:
for rec in ( select a2.area,a1.sp,a1.hj 
                        from
                           (SELECT a.org_id,b.prod_catalog sp, count(distinct a.billing_no) hj
                             from cyj_zgq_day_report_ls a, YZ_OFFER_FLAG b
                            where a.region_id = 73508
                              and a.prod_offer_id = b.prod_offer_id
                              and a.service_offer_id = '80000045'
                              and to_char(a.complete_date, 'yyyymmdd') = cTj_Day
                            group by a.org_id,b.prod_catalog) a1,
                            ar_area                           a2
                        where a1.org_id=a2.org_id
   )loop   cRegion := cRegion||rec.area||'【'||rec.sp||':'||rec.hj||'户'||'】'; 这样结果就是:安仁【450D签转:1户】安仁【E9:2户】安仁【【450D签转:1户】】  我要得到的结果:安仁  【450D签转:1户;450D签转:1户,E9:2户】 这个语句要怎么写?

解决方案 »

  1.   

    没懂楼主什么意思
    dbms_output.putline  ???
      

  2.   

    试试这个:
    select a2.area||'【'||wmsys.wm_concat(a1.sp || ':' || a1.hj  || '户') ||'】'
      from
      (SELECT a.org_id,b.prod_catalog sp, count(distinct a.billing_no) hj
      from cyj_zgq_day_report_ls a, YZ_OFFER_FLAG b
      where a.region_id = 73508
      and a.prod_offer_id = b.prod_offer_id
      and a.service_offer_id = '80000045'
      and to_char(a.complete_date, 'yyyymmdd') = cTj_Day
      group by a.org_id,b.prod_catalog) a1,
      ar_area a2
      where a1.org_id=a2.org_id;
      

  3.   

    问题就在最后一行输出的格式问题:
    cRegion := cRegion||rec.area||'【'||rec.sp||':'||rec.hj||'户'||'】';我想要得到这样的结果:安仁 【450D签转:1户;450D签转:1户,E9:2户】 (注明:安仁是一个营业区area)
      

  4.   


    问题就在最后一行输出的格式问题:
    cRegion := cRegion||rec.area||'【'||rec.sp||':'||rec.hj||'户'||'】';我想要得到这样的结果:安仁 【450D签转:1户;E9:2户】 (注明:安仁是一个营业区area)