0

Is there a way to receive just acquired id by my insert query?

I am using java.sql package and I heard that there is a way without querying these keys again.

Or isn't?

oneat
  • 10,778
  • 16
  • 52
  • 70

2 Answers2

-1

You can use this query to get your result. This query should be run in the same session which was used to perform insert.

select last_insert_id();
Gajender
  • 107
  • 1
  • 6
-1

If you try to an auto-increment key value ,then you can see the post :

[Retrive the auto-increment field using PreparedStatement.][1]

Insert using PreparedStatement. How do I auto-increment the ID? [1]:

Community
  • 1
  • 1