Q
Problem solve Get help with specific problems with your technologies, process and projects.

Using Java to find value of nextval

I am inserting a row into an Oracle database using jdbc as stmt.executeQuery ("insert into tblXXX values(seque...

nceX.nextval,.....)");

Now I want to get the actual value of the first field (sequenceX.nextval) that has been inserted into the database that I want to subsequently use in my Java application. How can I acheive this in Java?


stmt.executequery("select sequencex.currval from dual");

Note currval will only work after nextval has been executed in the same session.


Dig Deeper on Using Oracle PL-SQL

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchDataManagement

SearchBusinessAnalytics

SearchSAP

SearchSQLServer

TheServerSide.com

SearchDataCenter

SearchContentManagement

SearchHRSoftware

Close