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: How2 Generate current date in spool-filename in SQL+

Re: How2 Generate current date in spool-filename in SQL+

From: <mlouwes_at_yahoo.com>
Date: 16 Jan 2003 01:42:52 -0800
Message-ID: <41434413.0301160142.4fe2badf@posting.google.com>


Thanks to everyone who helped, I could solve my issue with your help

Thanks again!

rs_arwar_at_hotmail.com (Rauf Sarwar) wrote in message news:<92eeeff0.0301150934.5e29e9b7_at_posting.google.com>...
> mlouwes_at_yahoo.com wrote in message news:<41434413.0301150351.1640818e_at_posting.google.com>...
> > I use sql+ and I want the results of my query in a spool file.
> > I need to run this query everyday from the Scheduler and want a new
> > file everyday, so I need to generate a unique filename in sql+
> > preferable with the current date in the name of the file.
> > How can I do this ??
> >
> > Thanks for your help
> >
> > Marcel
>
>
> You have an option to use either UTL_FILE package. Some sample code
> located at,
> http://groups.google.com/groups?dq=&hl=en&lr=&ie=UTF-8&selm=92eeeff0.0301131613.6c284a00%40posting.google.com&rnum=2
>
> OR
>
> Pass constructed filename as command line parameter to your sql file.
> e.g.
>
> Sqlfile.sql
> connect xxxx/xxxxx_at_xxxxx
> spool C:\YourSpoolDir\&1
> select ....
> spool off
> exit
>
> Construct your date e.g. on Win2K you can do something like,
> C:\> FOR /F "tokens=1-3 delims= " %%A in ("%date%_%time%") do set
> time_stamp=%%B%%C
> C:\> FOR /F "tokens=1-3 delims=/" %%A in ("%time_stamp%") do set
> time_stamp=%%A%%B%%C
> C:\> FOR /F "tokens=1-3 delims=:" %%A in ("%time_stamp%") do set
> time_stamp=%%A%%B%%C
> C:\> FOR /F "tokens=1-2 delims=." %%A in ("%time_stamp%") do set
> time_stamp=%%A%%B
> C:\> sqlplus @Sqlfile.sql %time_stamp%.spl
>
> Regards
> /Rauf Sarwar
Received on Thu Jan 16 2003 - 03:42:52 CST

Original text of this message

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