To run the script automatically, use some kind of a scheduler on your computer (MS Windows, for example, offer "Scheduled tasks" under Accessories - System tools). I'm not sure can it be done through TOAD (but I'd bet NO if you ask me), but I'm sure it CAN be done in SQL*Plus.
Spooling in Oracle can be done using SPOOL command in SQL*Plus. A very simple SQL script example would be this:
This is my query:
SET TERMOUT OFF;
SET ECHO OFF;
select to_char(a.day_of_creation,'yyyy-mm') as month,count(distinct a.customer_accountno) as aantal
from ecl_cases a
and (to_char(a.DAY_OF_CREATION,'yyyy-mm-dd')>='2004-10-01' and to_char(a.DAY_OF_CREATION,'yyyy-mm-dd')<='2004-12-31')
group by to_char(a.day_of_creation,'yyyy-mm')
order by to_char(a.day_of_creation,'yyyy-mm') asc;
I have saved this as test.sql
So, now I would like to only double-click on this file in Windows explorer to run it. So, without starting SQL*Plus myself. What should I do than?