title: sqlplus Dynamic Spool File Name
body: <p>I need to give the spool file name dynamically and I have to pass the parameters when I call sqlplus. Below is what I tried</p>
  
  <pre><code>echo exit | sqlplus "{{ Oracle_username }}/ {{ Oracle_pwd}} @(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(Host={{ Oracle_HostName }} )(Port=1521))(CONNECT_DATA=(SID= {{Oracle_SID }})))" @Script.sql 'AppName' 'DatabaseName' 'ObjectType'
  </code></pre>
  
  <p>Over here I tried to pass App Name, Database Name and Object Type dynamically. Prior to running SQLPLUS step, I create folders dynamically (App Name , Database Name , Object Type are all folders and it will vary depending on each application) .Below is how my script.sql looks like : </p>
  
  <pre><code>    SPOOL &amp;&amp;AppName/&amp;&amp;DatabaseName/&amp;&amp;ObjectType/Output.csv
      &lt;&lt;SQL Script&gt;&gt;
      SPOOL OFF
  </code></pre>
  
  <p>This doenst work . Can someone tell me what needs to be changed.</p>