sqlplus spool and substitution parameters [message #591230] |
Thu, 25 July 2013 12:56 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
tmcallister
Messages: 107 Registered: December 2007
|
Senior Member |
|
|
I'm trying to use &1 to pass in a file name prefix.
i.e.
spool &1_result.xml;
EXEC dbms_output.put_line(dbms_xmlgen.getXML(dbms_xmlgen.newContext('select * from dual')));
spool off
spool &1_detail.xml
EXEC dbms_output.put_line(dbms_xmlgen.getXML(dbms_xmlgen.newContext('select * from dual')));
spool off
But this doesn't use the parameter passed in from the command line. If I encase the parameter in quotes '&1' then it works, but then the filename has quotes. I've tried &1 || '_results.xml' but that doesn't work with spool; maybe if I built the filename seperately from the spool command?
I could also just pass in 2 filenames and use &1 and &2; but that is inconvenient in the current manner that this file is being called.
Thanks for any help!
|
|
|
|
|