title: Value from last inserted row in DB
body: <p>Is there some way to get a value from the last inserted row?</p>
  
  <p>I am inserting a row where the PK will automatically increase due to sequence created, and I would like to get this sequence number. Only the PK is guaranteed to be unique in the table.</p>
  
  <p>I am using Java with a JDBC and Oracle.</p>
  
  <p>I forgot to add that I would like to retrieve this value using the resultset below. (I have tried this with mysql and it worked successfully, but I had to switch over to Oracle and now I get a string representation of the ID and not the actually sequence number)</p>
  
  <pre><code>Statement stmt = conn.createStatement();
  stmt.executeUpdate(insertCmd, Statement.RETURN_GENERATED_KEYS);
  stmt.RETURN_GENERATED_KEYS;
  ResultSet rs = stmt.getGeneratedKeys();
  if(rs.next()){
     log.info("Successful insert");
     id = rs.getString(1);
  }
  </code></pre>
  
  <p>The above snippet would return the column int value stored in a mysql table. But since I have switched over to Oracle, the value returned is now a strange string value.</p>