title: Automate scripts
body: <p>I have bunch of SQL statements and I want to put them in a script and run them together and produce an EXCEL (*.xls) file; how can I do that in toad?</p>
  
  <p>Example of script</p>
  
  <pre><code>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 &lt;&gt;'Smart Specialist'
     And row_date BETWEEN TO_DATE('2012-SEP-01', 'YYYY-MON-DD')AND TO_DATE('2012-SEP-30', 'YYYY-MON-DD')
  </code></pre>
  
  <p>Second Statement</p>
  
  <pre><code>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'
  </code></pre>
  
  <p>Like above there are about 10 SQL statements. How do I combine them together in ORACLE?</p>