Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Using sysdate as Part of a File Name
I have a simple SQL script that simply reads a table colum and spools
it to a file.
Ex. Blah_Blah_FileName.out
However I'd like to have the file name contain the sysdate information as well 'YYYYMMDD'
Ex. Blah_Blah_FileName20050126.out, Blah_Blah_FileName20050127.out etc...
My script contains the following:
CLEAR BREAKS
CLEAR COMPUTES
TIMING START ZEIT
SET HEADING OFF
SET NEWPAGE 0
SET SPACE 0
SET LINESIZE 633
SET PAGESIZE 0
SET ECHO OFF
SET FEEDBACK OFF
SET COLSEP ''
SET ARRAY 10
SET TERMOUT OFF
SET UNDERLINE ''
SPOOL varial_lag.aus
SET COLSEP '|'
SELECT
to_char(sysdate,'YYYYMMDD')||'.out' filename
schreib_string
from w100.varial_kore
where gelesen <> 'J';
spool &spoolfile
commit;
spool off
SET TERMOUT ON
SET FEEDBACK ON
clear columns
clear breaks
clear computes
TIMING STOP
Received on Wed Jan 26 2005 - 06:31:59 CST
![]() |
![]() |