title: How to pass variable in PL/SQL block statement inside the UNIX shell script
body: <p>How to pass variable in PL/SQL block inside the UNIX shell script. Here is the ex-</p>
  
  <pre><code>#!/usr/bin/ksh
  declare -a arr=("01", "03", "05", "07", "09", "11")
  
  for i in "${arr[@]}"
  do
  
  $ORACLE_HOME/bin/sqlplus -s &lt;&lt;EOF
  scott/tiger
  set serveroutput on
  declare
    id   = &amp;1
    var    .........;
  begin
   for i in (select .... from ..... where id = &amp;id);
   loop
    select * from ..........;
    &lt;pkg&gt;.&lt;sp&gt;(var);    -- calling to execute job then process will do
   insert into ....... values(&amp;id, ........);
   end loop;
  end;
  </code></pre>
  
  <p>In the <code>&amp;id</code> at the time of run this anonymous <strong>PL/SQL</strong> block statement this value will be vary like 1, 3, 5, 7, 9, 10, 11 like this. It means for every ID this PL/SQL block will run automatically using this Shell script.</p>
  
  <p>For ex, if i run separate PL/SQL block in the SQL developer then for id = 01</p>
  
  <pre><code>set serveroutput on
  declare
    var    .........;
  begin
   for i in (select .... from ..... where id = 01);
   loop
    select * from ..........;
    &lt;pkg&gt;.&lt;sp&gt;(var);    -- calling to execute job then process will do
   insert into ....... values(01, ........);
   end loop;
  end;
  </code></pre>
  
  <p>Then same for rest of the ID this shell script should be run automatically.</p>