This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
I want to insert into mutliple tables using batch update like this,
Statement stmt= dbCon.createStatement(); stmt.addBatch("SELECT ID_SEQ.nextval as AID from dual"); stmt.addBatch("INSERT INTO AID_N VALUES (<AID>, "1"); stmt.addBatch("INSERT INTO AID_B VALUES (<AID>, "43"); stmt.addBatch("INSERT INTO AID_C VALUES (<AID>, "2");
How can I use the value AID selected in the first query, in the subsequent queries [inplace of <AID>].
I was assuming <AID> was the PK (which is the normal reason for using sequences). Reading the question again, I see that perhaps this isn't how mohamed zafer want's to use it. In which case you are correct, you need to do it in two seperate Statements.