Home » SQL & PL/SQL » Client Tools » sqlplus spool and substitution parameters (11.2.0.3.0 Windows 7)
sqlplus spool and substitution parameters [message #591230] Thu, 25 July 2013 12:56 Go to next message
tmcallister
Messages: 97
Registered: December 2007
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!
Re: sqlplus spool and substitution parameters [message #591231 is a reply to message #591230] Thu, 25 July 2013 12:58 Go to previous messageGo to next message
Michel Cadot
Messages: 58641
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
spool &1._result.xml;


Regards
Michel

[Updated on: Thu, 25 July 2013 12:59]

Report message to a moderator

Re: sqlplus spool and substitution parameters [message #591237 is a reply to message #591231] Thu, 25 July 2013 15:04 Go to previous message
tmcallister
Messages: 97
Registered: December 2007
Member
Perfect! Thanks!

I knew it was something simple; but my Google skills failed me.
Previous Topic: Oracle Reporting tools
Next Topic: SQLPlus command parser
Goto Forum:
  


Current Time: Fri Aug 01 06:01:44 CDT 2014

Total time taken to generate the page: 0.28802 seconds