Re: spooling SQL*PLUS to interactively concatonated filename
From: Scott Meade <scottmeade_at_briefcase.com>
Date: Wed, 27 Jan 1999 21:14:26 GMT
Message-ID: <36AF81AD.59544B63_at_briefcase.com>
Date: Wed, 27 Jan 1999 21:14:26 GMT
Message-ID: <36AF81AD.59544B63_at_briefcase.com>
One way: spool out a sql script which sets fileName, execute that script to actually set the name, and then spool to the name. Try this code snippet out:
1.) Create file called spoolDate.sql using text below. 2.) Run sqlplus user/pass_at_sid @spoolDate.sql. 3.) Should have created file with name 'out0127.txt' (if run today).
Good luck, have fun.
Scott M.
~ ~ ~
now spooling to date-based filename
set heading off
set feedback off
set pagesize 50000
set numformat 0999
set newpage 1
- Define file to spool to by creating a sql command
- which is executed to define fileName.
- [Doing a 'select' from db here, you can put in other audit items.
- For example, I keep an audit table and append sequential letters (a,b,c)
- to the filename. These letters (and other data) are read from the audit
- table.] spool definedest.sql select 'define fileName = ' || 'out' || to_char(sysdate, 'MMDD') || '.txt' from sys.dual; spool off
- Execute the 'define..' statement. _at_definedest.sql
- Now that fileName is 'defined' spool to it. spool &filename
- Spool to your heart's content here. select 'now spooling to date-based filename.....' from sys.dual; spool off
exit
Pat Gorden-Ozgul wrote:
> We run spool files in batch mode and would like to place the actual date in
> the stored spool filename itself for auditing purposes.
>
> If you know how, pls email me: gorden_at_bnl.gov. Thx.
Received on Wed Jan 27 1999 - 22:14:26 CET