I am trying to spool to a csv that contains the current_date in its name:
spool '\mydir\'||to_char(current_date,'YYYYMMDD')||'.csv';
SELECT /*csv*/* FROM mydata;
spool off;
However, I get an error:
SP2-0768: Illegal SPOOL command
Usage: SPOOL { <file> | OFF | OUT }
where <file> is file_name[.ext] [CRE[ATE]|REP[LACE]|APP[END]]
Is it not allowed? Is there a workaround?
The same error appears if I try using a substitution variable, which does not seem to be allowed either.