|
The RRN technique breaks as soon as you need an order by. There's no way (besides making a temporary table) to use the RRN values for ordered recordsets. Eric DeLong Sally Beauty Company MIS-Project Manager (BSG) 940-898-7863 or ext. 1863 -----Original Message----- From: Haas, Matt [mailto:Matt.Haas@xxxxxxxxxxxxxxxxxxx] Sent: Thursday, May 15, 2003 8:40 AM To: RPG programming on the AS400 / iSeries Subject: RE: Select Row Steve, I saw your post almost right after I sent mine (it takes forever for my e-mails to make the round trip for some reason) and you're right, the fetch xx rows does work on V5R1. Thanks for sharing that, I'm sure it will come in handy. As for the RRN trick, I didn't mean to say it doesn't work at all, I meant to say it isn't all that useful for selecting x number of rows on real world files. For example, let's say you try your example where CUNBR > 9000 and CUNBR < 10000 and RRN < 10. Chances are, none of these records will have a RRN less than 10 so you get no data. Matt -----Original Message----- From: Steve Landess [mailto:steve_landess@xxxxxxxxxxx] Sent: Thursday, May 15, 2003 9:05 AM To: RPG programming on the AS400 / iSeries Subject: Re: Select Row >Matt wrote: > Ren, > Prior to V5R2 (I think this is part of V5R2), you can't do this with a SELECT statement. The relative record number idea will only work if there are no deleted records and you don't use a where clause which, IMHO, makes this trick all but useless in most cases. Matt: I don't know about prior releases, but both of the following SQL statements work on V5R1: select *from cusmst fetch first 2 rows only SELECT statement run complete. SELECT * FROM cusmst WHERE CUNBR < 100 AND rrn(cusmst) < 10 SELECT statement run complete. Steve Landess Austin, Texas (512) 423-0935 _______________________________________________ This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/rpg400-l or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.