• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Web Service Paging

 
Mike London
Ranch Hand
Posts: 1227
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We have an Oracle application that's a backend for a web service.

The front end will make requests and I need the web service part to allow paging of resultsets.

Therefore, I was trying to implement paging using the ROWNUM pseudo column, but it only partly works.

If I say WHERE ROWNUM < 5, then I correctly get the one row row with ROWNUM = 1.

But, the utterly confusing thing is if I try this WHERE clause (where ROWNUM = 1 in the result set), it returns nothing:

... WHERE ROWNUM ≥ 1 and ROWNUM < 5

I'm not sure what's going on with ROWNUM, but the above is true: 1 is greater or equal to 1 and 1 is less than 5.

Can anyone shed some light on how best to implement paging using Oracle syntax?

Perhaps I should be using some built-in Oracle function instead?

Thanks very much in advance.

- mike
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35279
384
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mike,
This Ask Tom article shows the patterns for paging. In particular, that you need a nested query.
 
Mike London
Ranch Hand
Posts: 1227
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jeanne Boyarsky wrote:Mike,
This Ask Tom article shows the patterns for paging. In particular, that you need a nested query.


Thanks very much. Paging in Oracle is a bit confusing, but I see now what I need to do.

Appreciate your reply.

-- mike
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic