Home » RDBMS Server » Server Utilities » SQL*plus : How to SPOOL to variable file name
SQL*plus : How to SPOOL to variable file name [message #368255] Thu, 19 October 2000 08:43 Go to next message
Kevin J.
Messages: 3
Registered: October 2000
Junior Member
When you use SPOOL command in SQL*PLUS :
SPOOL C:\FILE.TXT
it can only spool to fixed destination
How to spool to a place where file name is uncertain
like this one :
SPOOL &file
Don't use ACCEPT command
Re: SQL*plus : How to SPOOL to variable file name [message #368259 is a reply to message #368255] Fri, 20 October 2000 14:38 Go to previous message
Andrew
Messages: 144
Registered: March 1999
Senior Member
There is a subtle difference between using variables like &1 and &file.

===================================
set verify off
spool &1
prompt Your output file is &1
spool off
===================================

Set verify off prevents the debug from displaying the replacement of &1
If &1 does not contain an extension, SQLPlus will add a ".LST"
You can tag an extension (e.g. ".txt") on using the following syntax &1..txt

The first "." is a de-limiter and the second one is the one which forms part of the extension ".txt"

Start the file and supply the value as a command line parm:
SQL> start t.sql C:\spoolfile.log
Previous Topic: EXPORT ERROR
Next Topic: sysdba password ??
Goto Forum:
  


Current Time: Fri Apr 19 20:42:21 CDT 2024