I need to query a table in the database on a column which is a VARCHAR2
.
I need to retrieve the records in chunks, not all at one go. ROWNUM
is used for this purpose.
The query is like this:
select * from SOMETABLE
where SOMECOLUMN > ?
and rownum <= 100
order by SOMECOLUMN
This query is run repeatedly by changing the SOMECOLUMN
value. To start with, this query should be supplied with the least VARCAHAR2
value so that I get the first 100 records (not in any specific order though). Next time, the SOMECOLUMN
value in the 100th record is used (order by
is added to the query for this purpose) , so that it gets the next 100 records and so on.
(Assumption: SOMECOLUMN
values are unique).
What can be the initial least value supplied to this query?
You can use
MIN()
orMAX()
also for VARCHAR2 data, not only for numbers. You can use this one: