Spool an output file to dynamic filename
Hi.
Let say I have an Oracle Script as following:
spool c:\hms_report\HMS.xls
SELECT
field1||chr(9)||field2
from table1;
spool off
exit
Question:
Currently the output file will be HMS.xls
If I run the script thrice a day, the HMS.xls will be overwrite.
Is there any way to name the output file to be HMS+sysdate ie: If I run the script on 05-Nov-2002 09:00,
the output file name will be HMS051120020900.xls
where 05 = dd
11 = mm
2002 = yyyy
0900 = hhmi
Thanks.