Home » Other » 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: 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!
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: 68625
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: 107
Registered: December 2007
Senior 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: Thu Mar 28 17:20:29 CDT 2024