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
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.