Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 830357
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T04:01:52+00:00 2026-05-15T04:01:52+00:00

I have to fetch only 50 records at a time from database (DB2), for

  • 0

I have to fetch only 50 records at a time from database (DB2), for this I have been using Row_Number but now the persons are telling that this Row_Number is not stable and has bugs in it so now I have to write a different query for the same as I have to fetch only 50 records at a time.

So please can any body help me out for the same?

Thanks in advance.

The query which I have been using is

SELECT PLC.* 
FROM
     (SELECT 
          ROW_NUMBER() OVER (ORDER BY PRDLN_CTLG_OID) AS Row,
          PRDLN_CTLG_OID, 
          PRODUCT_LINE_OID      AS  PRODUCT_LINE_OID, 
          RTRIM(CATALOG_ID)             AS  CATALOG_ID,
      FROM 
          PROD_LINE_CATALOG 
      WHERE 
          PRODUCT_LINE_OID = :productLineOID AND ACTV_IND = 1 
      ORDER BY CATALOG_ID) PLC
WHERE  
    Row >= :startIndex AND Row <= :endIndex
ORDER BY 
    PLC.CATALOG_ID DESC 
WITH UR
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T04:01:52+00:00Added an answer on May 15, 2026 at 4:01 am

    use the fetch clause

    FETCH FIRST 50 ROWS ONLY
    

    edit

    It looks like you use a startIndex and endIndex value. I realize you compare these to Row, but do you have another index to compare? If not, and you insist on moving from Row_Number, maybe the table needs another index.

    Select PLC.* From (Select omitting row_number())
    Where yournewindex >= startIndex
    Fetch first 50 rows only
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say we have to fetch only 5 records from a table but my
I have to fetch all the files from a folder and i am using
I have to fetch about few hundreds records from CoreData and group them by
I'm working on a site now that have to fetch users feeds. But how
I have a GridView which shows only 50 records at a time through paging.
I am using graph API. I have to fetch feed(i.e.. posts on the particular
I can't seem to find the resolution for this. I have modified the Fetch
I have this query to fetch the total OrderStatus that have values 1 and
I have a script that will fetch data from server and compose a DIV
I am trying to fetch records based on two dates from sql server... Select

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.