If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > how to query with index range

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-20-04, 16:17
manth manth is offline
Registered User
 
Join Date: Mar 2004
Posts: 54
how to query with index range

Hi,

I have the following query.

SELECT PUTDATE, PUTTIME, MSGID, MSGTYPE FROM DB2A.MQMD WHERE TSTAMP BETWEEN '2004-04-20-10.00.00' AND '2004-04
-20-10.20.59'

I wanted to retrieve 10 records at a time bcz it will return huge ResultSet.

How will be the query to retrieve the data with index range?

I appreciate ur help.

Thanks
Reply With Quote
  #2 (permalink)  
Old 04-21-04, 04:34
Walter Janissen Walter Janissen is offline
Registered User
 
Join Date: Nov 2003
Location: Germany
Posts: 62
If you only want to retrieve 10 rows, you can use the clause FETCH FIRST 10 ROWS ONLY. Is that what you meant?
Reply With Quote
  #3 (permalink)  
Old 04-21-04, 08:31
manth manth is offline
Registered User
 
Join Date: Mar 2004
Posts: 54
No, i will pass first and last index ranges.
Let me put this way.
if my query can return 200 records, i should retrieve 50 records at a time instead of retrieving all the 200 records at a time.

This will help me if my query has chances to return 100,000 records.
So in that scenario, my application performance drastically come down.
So to aviod that first i will get only first 50 records first and show it, when user clicks next button i will get next 50 records from DB and display and so on.

I guess you might have understood my requirement.

Thanks
Reply With Quote
  #4 (permalink)  
Old 04-21-04, 10:53
manth manth is offline
Registered User
 
Join Date: Mar 2004
Posts: 54
may we can do it using explicit cursor. I need help in this direction.

Thanks
Reply With Quote
  #5 (permalink)  
Old 04-21-04, 11:30
sathyaram_s sathyaram_s is offline
Super Moderator
 
Join Date: Aug 2001
Location: UK
Posts: 4,534
Search for the words Pagination and/or Naveen in

www7b.boulder.ibm.com/dmdd

HTH

Sathyaram

Quote:
Originally posted by manth
may we can do it using explicit cursor. I need help in this direction.

Thanks
__________________
Visit the new-look IDUG Website , register to gain access to the excellent content.
Reply With Quote
  #6 (permalink)  
Old 04-21-04, 13:25
manth manth is offline
Registered User
 
Join Date: Mar 2004
Posts: 54
Satyaram,
It's useful information for me. I appreciate it. It's nice link. This is what i am looking for.

Thanks
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On