Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Using sysdate as Part of a File Name

Re: Using sysdate as Part of a File Name

From: Mark C. Stock <mcstockX_at_Xenquery>
Date: Wed, 26 Jan 2005 08:09:09 -0500
Message-ID: <IaGdnX9qNrXoC2rcRVn-qA@comcast.com>

<paul.izzo_at_mosca-ag.com> wrote in message news:1106742719.503566.173660_at_f14g2000cwb.googlegroups.com...
>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
>

SQL> column today new_value v_today
SQL> select to_char(sysdate,'mmddyyyy') as today from dual   2 /

TODAY



01262005

SQL> spool spfile_&v_today
SQL> spool
currently spooling to spfile_01262005.LST

++ mcs Received on Wed Jan 26 2005 - 07:09:09 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US