title: how to join two ResultSets from oracle queries in java
body: <p>Is it possible to join two ResultSets like join two tables in Java-oracle programming?  I am writing a java program which querys two different oracle databases(the databases are physically in different locations). In the program, sql1 returns ResultSet ret1;sql2 returns ResultSet ret2.   Suppose ret1  has the following data:</p>
  
  <pre><code>Id   item
  ------------
  1   item1
  2   item 2
  3   item 3
  .........
  </code></pre>
  
  <p>Ret2 has the following data</p>
  
  <pre><code>Id  info
  ---------
  1  info1
  2  info2
  …
  </code></pre>
  
  <p>I need result like this</p>
  
  <pre><code>Id item info
  ----------------------
  1   item1 info1
  2   item2  info2
  </code></pre>
  
  <p>Can I do something like this in java:</p>
  
  <pre><code>Select ret1.id,ret1.item,ret2,info from ret1, ret2 where ret1.id=ret2.id
  </code></pre>
  
  <p>I know I can loop from ret1 and get the id then get info from ret2; I am wondering if there is a fast way like join two tables to join two ResultSets without looping? Actually these two results both have half million rows. Thank you!</p>