How do I put the current date in a spool file name?

column dcol new_value mydate noprint

select to_char(sysdate,'YYYYMMDD') dcol from dual;

spool &mydate._report.txt
-- my report goes here

select * from mytable;

spool off

2 comments :

  1. Thanks. Exactly what I was looking for.

    ReplyDelete
  2. how can i append sysdate without substution??can you please help me?

    ReplyDelete