title: Connecting to two different databases and compare the table result using shell script
body: <p>I have a task of copying the data from one database to another.I don't have privileges to create DB Link.So, I have achieved this task using COPY command in shell script. But now, I need to compare the count of records between the databases. I used to do this manually. But now,I want to automate this.</p>
  
  <p>As per my knowledge, Sqlplus allows me to connect to one database at a time. But I want something like</p>
  
  <pre><code>sqlplus -s un/pwd@sid &lt;&lt;EOF
   SELECT count(*) FROM table1 WHERE column1 = 'abc'  -- first database
   UNION ALL
   SELECT count(*) FROM table1 WHERE column1 = 'abc';  -- second database
  exit
  EOF
  </code></pre>
  
  <p>Is it possible to omit sqlplus string and add it in the query?</p>
  
  <p>Thanks,
  Savitha</p>