This week's book giveaway is in the OCAJP forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line! See this thread for details.
I need to insert two records into a Oracle DB, which are linked via object id's which are generated from a sequence. So, the code would be: Create Record1 Set Record1.Id = some sequence Create Record2 Record2.Link = Record1.Id But, once I have created record1 how do I know which record was created, or with which sequence? Please help. email@example.com
Can you just run a SELECT statement to get the sequence number and store it in a variable for later use? long sequenceNum = 0; ResultSet rs = Statement.executeQuery("select sequence_name.nextval from dual"); if (rs.next() ) sequenceNum = rs.getLong(1); Brian