My app needs to know which row receives which key in the database.
I am using JDBC on read commited isolation level with batch updates. Therefore retrieving the keys with getGeneratedKeys isn’t possible. My plan is to fetch a Range of ids from the database in a transaction safe way, e.g. two parallel transactions can’t get the same keys.
Can I write some SQL-Query with the number of future rows as an argument to fetch a list of future keys in Oracle 11g?
What are my options here?
you can use sequences for this purpose:
to retrieve a id
or to retrieve a range of ids :