|
|
| Author |
Message |
appala_srinivas
New User
Joined: 30 Aug 2005 Posts: 3
|
|
|
|
Hi All,
My Problem.
--------------
I have one DB2 Table(ex. Employee).
I want to create a Cursor it retrieve 10 records only at a time.
i execute it 2nd time, then it fetch from 11 to 20 records.
i execute it 3rd time, then it fetch from 21 to 30 records.
i execute it 4th time, then it fetch from 31 to 40 records.
like this way i fetch 100 records.
This query i will include in the sub-program. The main program calls the subprogram 10 times , so that i can retrieve 100 records.
Regards,
Srinivas.a |
|
| Back to top |
|
 |
References
|
|
 |
krishnaiahc
New User
Joined: 31 Aug 2005 Posts: 14
|
|
|
|
Hai,
By using Fetch first n rows only.... I think it will help for requirement..
Regards,
Krishna |
|
| Back to top |
|
 |
ovreddy
Active User
Joined: 06 Dec 2004 Posts: 200 Location: Keane India Ltd., Hyderabad
|
|
|
|
Hi Srinivas,
Your requirement looks like a Scroll logic in an Online screen i.e. in a CICS+DB2 Program. To fulfill your requirement you need to do 2 things.
- Write a DB2 Cursor Query which is generic and fetches next 10 records to the given Variable.
Eg: SELECT COL1,COL2,Col3... INTO :HV-VAR1,:HV-VAR2,:HV-VAR3,.... WHERE MBNISS>:HV-MBNISS FETCH FIRST 10 ROWS ONLY;
- I hopes the HV-MBNISS will contain the last record fetched from the table. It means 10th record in first case, 20th in second ran .....
- If you want to exit and restart the program again and again (Other than online scrolling logic) You need to write last MBNISS to a file before closing the cursor. And when you start the program next time you read that file and execute this query.
I know this is not looking clear for you. But I expect you to come up with more details about your case.
Thanks,
Reddy. |
|
| Back to top |
|
 |
|
|
|