spooling a file with filename and current timestamp [message #243998] |
Mon, 11 June 2007 04:24 |
gautamvv
Messages: 254 Registered: June 2005
|
Senior Member |
|
|
i am running an sql file, my aim is to generate a log file
which shows the filename followed by current timestamp
i am using spool, but not getting it, please help
SET head off echo off termout off feedback off verify off linesize 228 trimspool on
SET head off echo off termout off feedback off verify off linesize 90 trimspool on wrap off
begin
dbms_output.put_line('hi1');
end;
spool test.log
set serveroutput off
SELECT 'define filename=test_'||TO_CHAR(SYSDATE,'YYYYMMDDHH24MISS')||'.log' FROM dual;
spool off
/
what i want is a log file which has test_(current timestamp
appears here)
|
|
|
|
|
|
Re: spooling a file with filename and current timestamp [message #244011 is a reply to message #243998] |
Mon, 11 June 2007 05:18 |
gautamvv
Messages: 254 Registered: June 2005
|
Senior Member |
|
|
col filename new_value filename
SELECT 'test_'||TO_CHAR(SYSDATE,'YYYYMMDDHH24MISS')||'.log' filename
FROM dual
spool &filename
begin
dbms_output.put_line('hi');
end;
spool off
/
i am confused now, i want to include this in some sql script
which has a declare, begin and end....
i am confused about where to place the example
cause using the above script, i am not getting the log file
goes to show my understanding regd set commands is poor
somebody please help
|
|
|
|
Re: spooling a file with filename and current timestamp [message #244040 is a reply to message #243998] |
Mon, 11 June 2007 07:12 |
gautamvv
Messages: 254 Registered: June 2005
|
Senior Member |
|
|
SET head off echo off termout off feedback off verify off linesize 228 trimspool on
SET serveroutput ON SIZE 999999
col filename new_value filename
SELECT 'gautamlog_'||TO_CHAR(SYSDATE,'YYYYMMDDHH24MISS')||'.log' filename
fROM dual;
spool &filename;
begin
dbms_output.put_line('hi');
end;
/
spool off;
thanks !
|
|
|