M
M
Maxim Isaev2021-06-07 08:04:52
Java
Maxim Isaev, 2021-06-07 08:04:52

Is it possible to get data from ResultSet without deleting it from ResultSet?

Good day to all.

Tell me, please, is it possible to read data from the ResultSet without extracting it from the ResultSet using getSomeType?
If not, are there any workarounds?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Gornostaev, 2021-06-07
@MaximIs

ResultSet is an iterator, data is not removed from it, it does not contain it at all. Roughly speaking, the call to next shifts the base cursor, which returns a new row of the selection. The workaround is to store the results in a list if you're sure the query didn't return more data than will fit in memory.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question