Limit result set to specific number of rows.

Posted by Admin on 07-Mar-2008 13:10

I'm a newbie to OpenEdge and I'm trying to limit my result set. OpenEdge doesn't appear to support Limit (10) or select top(10) as many other databases do. Can anyone please let me know how this is done in OpenEdge (10.1b). Thanks

All Replies

Posted by Thomas Mercer-Hursh on 07-Mar-2008 13:21

You don't mention your version of Progress, which is critical in this case. TOP is supported by the most recent versions, but only the most recent versions.

Posted by Admin on 07-Mar-2008 14:01

Thank you for the reply. I had a couple different versions I was working with, and I suppose I had attempted the select top on the older version which doesn't support it. After another try in 10.1b, it works like a charm. Thanks again.

Posted by Thomas Mercer-Hursh on 07-Mar-2008 14:28

How nice that you actually have a reasonably current version. It can get very tiring telling people that something is right there ready for use in a reasonably current version only to have them reply that they need it to work in 9.1E ... or 8.3 .... or ...

Posted by Admin on 21-Apr-2008 09:09

Can someone tell me how to do this in 9.1C? any help will be appreciated.

thanks

Posted by rstanciu on 21-Apr-2008 10:06

I think, this code is running from Progress v.6.x to OpenEdge v.10.x

DEFINE VARIABLE li AS INTEGER NO-UNDO.

FOR EACH Customer FIELDS(CustNum Name City) NO-LOCK:

li = li + 1.

IF li > 10 THEN LEAVE.

DISPLAY CustNum Name.

END.

Posted by Thomas Mercer-Hursh on 21-Apr-2008 11:00

Unfortunately, there is no such simple construct in SQL unless on has TOP. The only other option I know of is to set FetchLimit.

This thread is closed