Please tell me how to return the id of the record that was inserted using the INSERT. As an option, you can make another request after insertion, but this is not very.
I am writing in Java.
PreparedStatement ps = con.prepareStatement(sql,Statement.RETURN_GENERATED_KEYS); stmt.executeUpdate(); ResultSet rs = stmt.getGeneratedKeys(); rs.next(); return rs.getInt(1); rs.getInt(1); why exactly 1 ? and not "id" ? - TsyklopSource: https://ru.stackoverflow.com/questions/534562/
All Articles
getGeneratedKeys(). - PinkTux