Java JDBC - Multiple prepared statement bulk insert

后端 未结 2 915
生来不讨喜
生来不讨喜 2020-12-15 09:28

Using JDBC (Oracle) I need to insert about thousand rows into each of two tables. Something like this:

\"INSERT INTO TABLE_A (A_ID, A_NAME, A_LAST_NAME) VALU         


        
2条回答
  •  臣服心动
    2020-12-15 09:39

    If I understand your problem correctly, you have a problem with NEXTVAL and CURRVAL since CURRVAL might change due to other DB use? If so, you can change your code to this order:

    currentNextVal = select NEXTVAL
    INSERT into table_a with currentNextVal as the id
    INSERT into table_b with the same currentNextVal 
    

    Did I understand your problem correctly?

提交回复
热议问题