title: How to get sequence.nextval from SQL in JDBC?
body: <p>I have 5 tables where I use the same sequence's next value. The problem is, the subsequent tables gets a bigger value than the previous ones.</p>
  
  <p>My code is like this:</p>
  
  <pre><code>String sql = "INSERT INTO table1(id, name) VALUES (id_seq.nextval, ?)"; 
  ps.setString(1, "bar"); 
  ps.executeUpdate();     
  sql = "INSERT INTO table2(id, name) VALUES (id_seq.nextval, ?)";
  ps.setString(1, "tar"); 
  ps.executeUpdate();
  sql = "INSERT INTO table3(id, name) VALUES (id_seq.nextval, ?)";
  ps.setString(1, "par"); 
  ps.executeUpdate();
  sql = "INSERT INTO table4(id, name) VALUES (id_seq.nextval, ?)";
  ps.setString(1, "car"); 
  ps.executeUpdate();
  sql = "INSERT INTO table5(id, name) VALUES (id_seq.nextval, ?)";
  ps.setString(1, "rar"); 
  ps.executeUpdate();
  </code></pre>
  
  <p>My sequence is like this:</p>
  
  <pre><code>CREATE SEQUENCE  "ID_SEQ"  MINVALUE 1 MAXVALUE 9999999999 INCREMENT BY 1         START WITH 10 CACHE 20 NOORDER  NOCYCLE ;
  </code></pre>
  
  <p>Now when I look at my tables, table1's ID is 10, but table2's ID is 11 and table3's ID is 12..... I want all the tables' IDs to be same. What should I do? 
  Thank you in advance.</p>
  
  <p>edit: Had to include more tables than 2 to have more general question</p>