Spooling to a file that includes the date and time [message #2913] |
Wed, 21 August 2002 04:01 |
Jon
Messages: 483 Registered: May 2001
|
Senior Member |
|
|
I'm currently trying to spool outputs of a script however what I want to do is add a time and date stamp the filename so it will be easy to keep a record of when I ran the script.
at the moment I'm simply using
spool output.txt
when I want something like
spool outputDate.txt
|
|
|
Re: Spooling to a file that includes the date and time [message #2914 is a reply to message #2913] |
Wed, 21 August 2002 05:19 |
Wijnand
Messages: 11 Registered: March 2002
|
Junior Member |
|
|
set verify off
set termout off
COLUMN a new_val thisuser noprint
COLUMN b new_val thisdb noprint
COLUMN c new_val todaysdate noprint
select USER a, nvl(substr(global_name, 0, instr(global_name, '.')-1), global_name) b, TO_CHAR(SYSDATE,
'YYYYmmdd_HH24MI') c
from global_name;
column fname new_value fname noprint
SELECT 'my_log_&thisuser@&thisdb._&todaysdate..log' fname FROM dual;
set termout on
spool &fname
-- select * from emp;
spool off
prompt Your output filename is : &fname
|
|
|