我每个月有很多sql代码段要执行,例如:drop table pll_charge_midd;
create table pll_charge_midd as(
select *
from a_fav_sum_m@db2
where acct_month=to_char(add_months(sysdate,-1),'yyyymm')
);-------所有炫铃出账用户数及金额GCselect p.tele_type,
       c.BRANDCODE_DESC,
       d.city_desc,
       d.county_desc,
       f.busicode_desc,
       f.kindcode_desc,
       f.paycode_desc,   
       count(distinct p.user_no) 用户数,
       sum(p.charge) 金额
from pll_charge_midd p,
     rpt.d_area@ebi d,
     RPT.D_CODE_PRODUCT@EBI c,
     rpt.conf_charge_code@ebi f
where p.cut_tag=0
      and p.busi_code='ZT14'
      and p.eval_area_id=d.area_id
      and p.product=c.product
      and p.charge_code=f.charge_code
      and p.merger_code=f.merger_code(+)
      and p.busi_code=f.busi_code(+)
      and p.kind_code=f.kind_code(+)
      and p.pay_code=f.pay_code(+)
group by p.tele_type,
       c.BRANDCODE_DESC,
       d.city_desc,
       d.county_desc,
       f.busicode_desc,
       f.kindcode_desc,
       f.paycode_desc       
;  
-------语音业务情况表
select p.tele_type,
       c.BRANDCODE_DESC,
       d.city_desc,
       d.county_desc,
       b.busi_desc ,     
       count(distinct p.user_no) 用户数,
       sum(p.charge) 金额
from pll_charge_midd p,
     rpt.d_area@ebi d,
     RPT.D_CODE_PRODUCT@EBI c,
     rpt.d_busi_code@ebi b
where p.cut_tag=0
      and p.busi_code like 'Z2%'
      and p.eval_area_id=d.area_id
      and p.product=c.product
      and p.busi_code =b.busi_code
group by p.tele_type,
       c.BRANDCODE_DESC,
       d.city_desc,
       d.county_desc,
       b.busi_desc
union all 
select p.tele_type,
       c.BRANDCODE_DESC,
       d.city_desc,
       d.county_desc,
       '增值_语音' busi_desc ,     
       count(distinct p.user_no) 用户数,
       sum(p.charge) 金额
from pll_charge_midd p,
     rpt.d_area@ebi d,
     RPT.D_CODE_PRODUCT@EBI c,
     rpt.d_busi_code@ebi b
where p.cut_tag=0
      and p.busi_code like 'Z2%'
      and p.eval_area_id=d.area_id
      and p.product=c.product
      and p.busi_code =b.busi_code
group by p.tele_type,
       c.BRANDCODE_DESC,
       d.city_desc,
       d.county_desc,
       b.busi_desc      
;这些代码有的是删除、创建表,有的是复杂的select语句,我想把select 语句直接生成csv文件,
有没有什么好的工具可以用,或者有什么好的方法可以解决,
注意,这些sql经常变动,以前我曾经用sql直接按照csv的格式写成文本文件,后来发现维护脚本的工作量太
大,有时还不如手工输出方便,有没有什么好的办法可以批量顺序输出脚本的结果成csv文件