GT,
Following is a technique that I find very useful to generate, "on-the-fly", replacement values for scripts that I run from SQL*Plus.
Since you have not posted the sources for the IP, folder name, and filename entries that you use for your example, above, I'll "stub" those entries with a SELECT of SQL*Plus variables (":var") from the DUAL table, but you can replace my stubbed SELECT with the
real SELECT that you would like to use, cause similar, successful results for your situation. (You can substitute my "var" and "exec" code for whatever you need to fit your scenario. the "col <label>..." statement format and the "SELECT..." methodology that assigns a value to the <label> is vital for the following to work:
Section 1 -- Proof of Concept script:
Code:
var IP char(15)
var folder char(50)
var fn char(50)
exec :IP := '127.0.0.1'
exec :folder := 'sqldba'
exec :fn := 'spool_test.txt'
col myprtfile new_value myprtfile
select '\\'||trim(:IP)||'\'||trim(:folder)||'\'||trim(:fn) myprtfile from dual;
spool &myprtfile
prompt This is test output to "&myprtfile".
spool off
get spool_test.txt
Section 2 -- Sample invocation (and results) of above script:
Code:
SQL> @tt_306
\\127.0.0.1\sqldba\spool_test.txt
1 row selected.
This is test output to "\\127.0.0.1\sqldba\spool_test.txt".
1* This is test output to "\\127.0.0.1\sqldba\spool_test.txt".
SQL>
Let us know if this techneque works to your advantage.
![[santa] [santa] [santa]](/data/assets/smilies/santa.gif)
Mufasa
(aka Dave of Sandy, Utah, USA)
[
Providing low-cost remote Database Admin services]
Click here to join
Utah Oracle Users Group on Tek-Tips if you use
Oracle in
Utah USA.