I am using JDBC to insert a row into a table and the id for that row is created using a sequence. Is there any way to get that sequence number right after you execute or a way to have that value returned.
Joined: Sep 13, 2004
Which database are you using..? For informix, you can do something like this.
Check your jdbc provider API, there might be something similar to this. Since this is database dependent, it is not part of standard JDBC API and beware you will lose portability if you use this.
Joined: Sep 24, 2005
Sorry I am using Oracle 10.2. I am trying select seq.nextVal from dual now and it seems to be working. Is this method thread safe?