title: Pass Parameters from a batch file to sqlplus script
body: <p>I am trying to get one file with my user name and passwords for some scripts that I run every day.  I have several scripts working now using a batch file that has my user names and passwords.</p>
  
  <p>My Password Batch file looks like this.
  parms.bat</p>
  
  <pre><code>Rem Oracle Db
  set odbUsername=myUserName
  set odbpassword=myPassword
  </code></pre>
  
  <p>My other scripts call that batch file and get the information ok.  I have a couple sql scripts that I also need to use these usernames and passwords.  I can't seem to get them to work. But I am fairly new to sqlplus scripting.</p>
  
  <p>My Sql Scripts looks like this.</p>
  
  <pre><code>CONNECT myusername@Oracleddbname/mypassword
  
  SET FEEDBACK OFF;
  SET ECHO OFF;
  SET TERMOUT OFF;
  SET HEADING OFF;
  SET PAGESIZE 0;
  SET LINESIZE 500;
  SET TIMING OFF;
  SET TRIMSPOOL ON;
  SET COLSEP ',';
  
  SPOOL C:\FileTransfers\MeterData.csv
  
  PROMPT CoopCode,MeterID,DateTime,Value
  SELECT DISTINCT
            a.coopcode
         || ','
         || a.meterno
         || ','
         || a.readdatetime
         || ','
         || a.usage
    FROM temp_reconfigured a, temp_goodsence b
   WHERE a.coopcode = b.coopcode AND a.meterno = b.meterno
  ;
  
  Spool off;
  
  EXIT;
  </code></pre>
  
  <p>I call this script with a batch file that runs through windows task scheduler.</p>
  
  <p>It looks like this.</p>
  
  <pre><code>sqlplus /nolog        @C:\FileTransfers\AutomationScripts\GoodSence\SpoolGoodSenceDataSet.sql
  </code></pre>
  
  <p>So I would like to pass the user name to the sql from the batch file.  I have read several things and tried about 30 and none seem to work.  Thank you for your help in advance.</p>