自动化脚本

时间:2012-10-26 17:33:41

标签: oracle scripting plsql

我有很多SQL语句,我想把它们放在一个脚本中并一起运行它们并产生一个EXCEL(* .xls)文件;我怎么能在蟾蜍那样做?

脚本示例

SELECT SUM(CASE 
             WHEN dvdn.ACDCALLS = (dvdn.ABNCALLS + dvdn.ABNCALLS1) 
             THEN dvdn.ABNCALLS    
             ELSE dvdn.ACDCALLS + dvdn.ABNCALLS - dvdn.ABNCALLS1 
           END) AS InboundCalls 
  from ccrdba.CMS_DVDN dvdn , ccrdba.VDN_DIM dim
 where DIM.DW_VDN_ID = DVDN.DW_VDN_ID (+)
   And DETAIL_GROUP like 'HD%'
   and vdn_name not like '%ASM%'
   And DIM.AGENT_GROUP <>'Smart Specialist'
   And row_date BETWEEN TO_DATE('2012-SEP-01', 'YYYY-MON-DD')AND TO_DATE('2012-SEP-30', 'YYYY-MON-DD')

第二声明

select count(*)
  from xx_new.xx_online_registrations@appsread.prd.com oreg
 where oreg.client_party_id = 141043767
   and oreg.cti_id IS NOT NULL
   and oreg.created_by = 'IVR-INTERACTIONS'
   and TRUNC(CREATION_DATE) between '01-SEP-2012' and '30-SEP-2012'
   and status = 'POSTED'
   and last_updated_by = 'IVR-INTERACTIONS'

如上所述,大约有10条SQL语句。如何在ORACLE中将它们组合在一起?

1 个答案:

答案 0 :(得分:0)

你可以试试“all all”,

        select col1 from table1
        union all
        select col1 from table2
        union all
        ...