title: Pass variables from shell script to SQL
body: <h2>I have an SQL statement file 1.sql:</h2>
  
  <pre><code>set pages 0
  set head off
  set feed off
  
  select $1 from
  (
         select $1 from user_tab_partitions
          where table_name = 'test'
              order by partition_position desc
          )
          where rownum = 1;
  </code></pre>
  
  <hr>
  
  <p>and I would like to execute the same SQL statement in a shell script, 1.sh:</p>
  
  <hr>
  
  <pre><code>#!/bin/ksh
  
  
  username="test"
  passwrd="testpass"
  partition_name=$1
  partition_position=$2
  
  PARTNAME=`sqlplus -s $username/$passwrd &lt;&lt; EOT
  @1.sql $1
  exit
  EOT`
  
  echo $PARTNAME
  
  PARTPOS=`sqlplus -s $username/$passwrd &lt;&lt; EOT
  @1.sql $2
  exit
  EOT`
  
  echo $PARTPOS
  </code></pre>
  
  <p>--</p>
  
  <p>So, basically what I'm doing is executing the same SQL but with different inputs. 
  and I don't know how to pass these variables from SHELL script to the SQL script.</p>
  
  <p>What should I change in my code???!!</p>
  
  <p>Thanks for your time!
  /Hesi </p>