title: How to use sql*plus in Windows command script to control flow?
body: <p>I'm trying to use sql*plus to control a small Windows command script.</p>
  
  <p>Basically, I want to execute some PL/SQL (perhaps select from a view or table or execute a function) which shows me the status of some rows in the database, and then depending upon the state of the rows, perform some Windows commands.</p>
  
  <p>My problem is how to get the results back into the command script.</p>
  
  <pre><code>sqlplus user/password@server @script.sql
  
  IF &lt;CONDITIONAL HERE BASED on script.sql results&gt; GOTO :runprocess
  
  REM log and email that process had to be skipped
  EXIT
  
  :runprocess
  REM run various Windows service commands
  </code></pre>