Can we execute some queries while traversing resultset in java

后端 未结 4 722
春和景丽
春和景丽 2021-01-05 16:30

I am trying to implement a task in java using JDBC like Stored Procedure in SQL. In SQL, when we write cursor, first we execute select query and then fetching the records we

4条回答
  •  庸人自扰
    2021-01-05 16:58

    ideally you can only have one statement executing at one moment in time against one database connection so you can either create and execute the second statement, or iterate through the resultset from first statement and store the data in collection (e.g. in an arraylist of hashmap) then close that statement and run the second one, this time retrieving the id's from the collection you saved them in.

提交回复
热议问题