title: Get last ID on inserted row in Oracle DB
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/3552260/plsql-jdbc-how-to-get-last-row-id">PLSQL JDBC: How to get last row ID?</a>  </p>
  </blockquote>
  
  
  
  <p>I have problem getting ID from tables. I have two tables AJPES_TR and TR_LOG and PK from TR_LOG table is set as foreign key in AJPES_TR table. </p>
  
  <p>In TR_LOG table I just write from which file data was imported and I want to link that PK into main table. In mySQL I was doing just fine with <code>getID.last(); int j = getID.getInt(TR_LOG_ID);</code> but now in Oracle this doesn't work anymore. </p>
  
  <p>These are my PreparedStatements:</p>
  
  <pre><code>PreparedStatement insertData = 
    con.prepareStatement(
      "INSERT INTO T_AJPES_TR(rn,sSpre,reg,eno,davcna,Ime,Priimek) VALUES (?,?,?,?,?,?,?)"
    );
  PreparedStatement select_file_log = 
    con.prepareStatement("SELECT * FROM T_AJPES_TR_LOG WHERE File_import = ?"
  );
  PreparedStatement getID = con.prepareStatement("SELECT * FROM T_AJPES_TR_LOG");
  PreparedStatement insertFile = 
    con.prepareStatement(
      "INSERT INTO T_AJPES_TR_LOG(Date_import,File_import) VALUES (?,?)"
    );
  </code></pre>
  
  <p>In mySQL IDs were set as autoincrement. </p>
  
  <p>How can I get ID value from TR_LOG and write that value in AJPES_TR table? </p>