Skip to Main Content

SQL Developer

Including SYSDATE in a spool file name

AnnieMJun 9 2021

Greetings!
I want to set a spool file name to 2 variables, plus SYSDATE.
It works for the 2 variables:
define PIDM1 = '12059500';
define PIDM2 = '12177237';
spool c:\temp_amm\&PIDM1._&PIDM2.BANPROD_data.txt
(file name is: 12059500_12177237BANPROD_data.txt)
Through a google search, I found that the typical set up to include SYSDATE is as follows
col date_stp new_value date_stp noprint
select to_char(sysdate,'yyyy_mm_dd') date_stp from dual;
spool c:\temp_amm\&date_stp.&PIDM1._&PIDM2.objects_data.txt
But it does not work for me; I receive a message box to provide the value for date_stp
Any thoughts on how to set this to work?
Later in the coding, I have the following set:
set echo off
set verify off
set feedback off
set headings off
set trimspool on
set termout on

Running in Oracle SQL Developer Version 19.2.1.247
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
Thank you so much for your time and help!

This post has been answered by KayK on Jun 14 2021
Jump to Answer
Comments
Post Details
Added on Jun 9 2021
5 comments
1,064 views