473,387 Members | 1,569 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

give me idea for this procedure

I want the criteria like this.

I have 10k of rows in my table and i have to fetch first 200 rows . And
next time when i execute the same query it should fetch next 200 rows
and that should be continued .For that is there any query for my
requirement or I have to write a dynamic sql procedure for this .

In Oracle using rowid we can get the records dynamically where as in
DB2 is the facility is there or not ?
Give some guidance regarding my requirement.

Feb 28 '06 #1
1 1031
narayana wrote:
I want the criteria like this.

I have 10k of rows in my table and i have to fetch first 200 rows . And
next time when i execute the same query it should fetch next 200 rows
and that should be continued .For that is there any query for my
requirement or I have to write a dynamic sql procedure for this .

In Oracle using rowid we can get the records dynamically where as in
DB2 is the facility is there or not ?
Give some guidance regarding my requirement.

Do you have a single column key?
E.g. you can do:
SELECT pk, data FROM T WHERE pk > ? ORDER BY pk FETCH FIRST 100 ROWS

For the first call use e.g. a negative empid (a value out of bound).
Then for each subsequent select you use the last pk you retrieved before
a input.

If that's not possible do this:

SELECT * FROM (SELECT ROW_NUMBER() OVER(ORDER BY whatever) AS rn, t.*
FROM T) AS X WHERE rn BETWEEN ? AND ?

Cheers
Serge

--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
Feb 28 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: dinesh prasad | last post by:
I'm trying to use a servlet to process a form, then send that data to an SQL server stored procedure. I'm using the WebLogic 8 App. server. I am able to retrieve database information, so I know my...
4
by: Luca | last post by:
Hello Everybody, I'm a 26 years old Italian "Florentine" Computer technician :) I'm writing you about an idea that I've got of a function that could be introduced in new web browsers (or even...
6
by: Vlad Olevsky | last post by:
Hi guys We have a following problem. For security reasons in each table in our DB we have addition field which is calculated as hash value of all columns in particular row. Every time when...
8
by: nrhayyal | last post by:
hi all, is it a good idea to assign object to pointers without initialising it to NULL? suppose if i have a class TEST class ELEMENT { private: int a; string s1;
19
by: Raposa Velha | last post by:
Hello to all! Does any of you want to comment the approach I implement for instantiating a form? A description and an example follow. Cheers, RV jmclopesAThotmail.com replace the AT with the...
9
by: David Helgason | last post by:
I'm calling one stored procedure with a prepared statement on the server with 6 arrays of around 1200 elements each as parameters. The parameters are around 220K in total. This is taking a...
1
by: narayana | last post by:
I want the criteria like this. I have 10k of rows in my table and i have to fetch first 200 rows . And next time when i execute the same query it should fetch next 200 rows and that should be...
1
by: Venkat | last post by:
Hi, Is there any way to give feedback to the application while a stored procedure execution is in progress? I am using sql server and my application is built using c#. The stored procedure tries...
32
by: Matias Jansson | last post by:
I come from a background of Java and C# where it is common practise to have one class per file in the file/project structure. As I have understood it, it is more common practice to have many...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.