on 2016 Jan 07 3:28 AM
Hi all,
If I want to select 1st~100th entries in database, OPEN SQL has a term 'UP TO 100 ROWS' to do it.
But I can not find a quickly way to select 100th~200th entries in database. Is there any method in open SQL, to let me select entries start at a specified index?
I need to support this features in SAP GATEWAY backend. Hope someone can tell me how to do it, thanks.
Regards
Dongqiang
Request clarification before answering.
Hi,
you can write your query like this :
SELECT * FROM <database table>
INTO |APPENDING/CORRESPONDING FIELDS OF TABLE <itab >
PACKAGE SIZE 100.
ENDSELECT.
it will give you entries in the form of package, append them to new internal table as per your requirement.
thanks!!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I don't think you can write such select statement, where you can specify index 100 to 200.
you can make use of LOOP AT <itab> FROM <index1> TO <index2> for multiple records based on index
or for single record
READ STATEMENT <itab> INDEX which will allow you to access record of particular index.
thanks!!
There is no concept of order in a relational database table. When you select up to 100 rows, you may get a different set the first time you run it from the second time. So your request doesn't really make sense.
Why would you want the "second 100 entries?" when that is simply not defined? In a relational database the phrase "second 100 entries" has no meaning - it doesn't exist.
If you need to pull records off 100 at a time (which is the usual scenario), then the answer has been given by Chintu Adi's first reply.
On that basis, and to prevent further point hunters repeating the same (or adding new, bad information), I'm locking the thread.
| User | Count |
|---|---|
| 15 | |
| 9 | |
| 6 | |
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.