title: Use a database value in SQLPLUS as a parameter to a batch file
body: <p>I need to run a batch file and pass in a database value. Depending on the day, a different value needs to be passed into the DOS command. This particular business rule is defined in a view in the database.</p>
  
  <p>Our primary scheduling tool is datastage which runs scripts in SQLPLUS, so this is my preferred method for schedules activities. I could also run a batch file directly taht calls SQLPLUS and gets a value, but there is much more hassle setting it up so I'd prefer not to.</p>
  
  <p>I'm a SQLPLUS amateur.</p>
  
  <p>The SQL script I'm passing into SQLPLUS is below. The problem I'm having is it's passing in :sTriggerName, not the value of it.</p>
  
  <pre><code>set echo on
  set feedback on
  set termout on
  
  
  VAR sTriggerName VARCHAR2(100)
  
  SELECT TRIGGERNAME INTO :sTriggerName 
  FROM SCHEMA.VIEW 
  WHERE CALENDAR_DATE = TRUNC(SYSDATE) AND ROWNUM &lt; 2;
  /
  
  HOST "E:\CallScheduleTrigger.CMD :sTriggerName."
  
  quit
  </code></pre>