mdtendulkar
Active User
Joined: 29 Jul 2003 Posts: 257 Location: USA
|
|
|
|
Hello Ananya,
Your requirement is non-standard. As per normal processing this can not be done.
Following are the ways to do it:
1) You can use only one cursor and process the specific number of records in paragraphs. say 1 to 15 in Para-1, 16-30 in Para-2 and remaining 15 records in Para-3.
In this way you can direct the processing in your desired manner.
2) The other way to do is as below:
| Quote: |
a) Get the number of records from the table for the query.
SELECT COUNT(*) FROM <TABLE-NAME> WHERE <WHERE-CONDITION>
b) Divide the count by 3 and get the integer records
c) In first Cursor by using FETCH FIRST N ROWS clause fetch the COUNT/3 records in ASCENDING order
d) In third Cursor by using FETCH FIRST N ROWS clause fetch the COUNT/3 records in DESCENDING order
(Here the last record will come first and first record will come last)
e) Now that you have first N/3 and last N/3 records there will be middle N/3 records remaining. These records can be retrieved by using the LAST KEY of both the cursors. (Last record's KEY of both the cursors)
SELECT * FROM <TABLE-NAME> WHERE KEY > KEY1 and KEY < KEY3
Here KEY1 = Last record of the first cursor.
KEY3 = Last record of third cursor.
|
I have not tried this solution, but you can try this out.
Hope this helps,
Regards
Mayuresh Tendulkar |
|