Unfortunately, Sybase does not provide the ability to set a trigger limit and an offset. The best you can achieve is to use SET ROWCOUNT to limit the number of records returned. If you have 1000 records and you want to create a page with 50 records, then something like this will return the first page ...
set rowcount 50 select * from orders
For the second page ...
set rowcount 100 select * from orders
... and then you may not display the first 50 of the Java code. Obviously, when you go forward a page, you have to return large and large data sets. Your question about what to do with 1,000,000 entries doesn't seem practical for a paginated user interface. No custom google searches and then pages forward 1,000 times looking for things.
What if I have a natural key?
If you have a relatively large data set and you can use the natural key in your data, this will help limit the returned records. For example, if you have a contact list and an interface that allows your users to choose from A to Z to place people in the directory based on their last name, you can do something like ...
set rowcount 50 select * from people where upper(surname) like 'B%'
If you have more than 50 people with a last name starting with "B", you use the same approach as above to go forward one page ...
set rowcount 100 select * from people where upper(surname) like 'B%'
... and remove the first 50 in the Java code.
By following this example, perhaps you can limit your search to a date or some other piece of data relevant to your users.
Hope this helps!
source share