Create spool file with timestamp in oracle

In this article we are going to learn how to create spool file with timestamp oracle database. “oracle spool date format”.

Connect with us on Social Network

spool file with timestamp oracle

Login into database and follow the below steps.

$sqlplus / as sysdba

Step 1: Create a dummy column with noprint option.

SQL> column dt new_value TDATE noprint

Step 2: Select sysdate with reference of above column.

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

Step 3: Prompt the column with ampersand symbol (&).

SQL> prompt &TDATE

Step 4: Now you can start spool with current date.

SQL> spool /u01/Your_file_name&TDATE..log

Write your query here, which out you want to record in spool file.


SQL>spool off;

I hope these steps will work for you perfectly.

Click here to read more Oracle Scripts

Connect with us on Social Network

Leave a Comment