title: How to use a PreparedStatement as a subquery in another prepared statement
body: <p>I'm using a <code>PreparedStatement</code> in my code to make queries.  For example:</p>
  
  <pre><code>PreparedStatement stmt = db.con.prepareStatement("select id from nodes where x&gt;? and x&lt;? and y&gt;? and y&lt;?");           
  stmt.setDouble(1, x1); 
  ... //set a value for each param 1 thru 4
  </code></pre>
  
  <p>And now I have another query that wants to use the exact same query above as a subquery.  So I could do:</p>
  
  <pre><code>PreparedStatement stmt2 = db.con.prepareStatement("select id from edges where startNodeId in 
  (select id from nodes where x&gt;? and x&lt;? and y&gt;? and y&lt;?)");
  </code></pre>
  
  <p>But that's repetitive and I'm likely to modify the first <code>PreparedStatement</code> and want those changes to propagate to the second one.  Is there a way to set a prepared statement to be a subquery in another statement?</p>
  
  <p>Perhaps something akin to <code>stmt2.setPreparedStatement(2, stmt)</code>?</p>