To get the current date/time as part of the spool file

Post date: 18-Nov-2015 14:30:12

This what i came across on one of Oracle Community thread Site: 

https://community.oracle.com/thread/30956

n SQL*Plus this is what you can do to get the current date/time as part of the spool file:

============================================================================================

SQL> column tm new_value file_time noprint

SQL> select to_char(sysdate, 'YYYYMMDD') tm from dual ;

1 row selected.

SQL> prompt &file_time

20020816

SQL> spool C:\Temp\logfile_id&file_time..log

.

.

. /* put your code here */

. /* it will go to a file called C:\Temp\logfile_id20020816.log */

.

.

SQL> spool off

SQL>