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 1091453
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T23:31:48+00:00 2026-05-16T23:31:48+00:00

I have a table with 100 K records. I am writing an XML file

  • 0

I have a table with 100 K records. I am writing an XML file based on this recordset. I need to write 100 records to a file at a time. So I will have 1000 separate files.

Currently to limit number of records getting written to a file, I am using the

SELECT * FROM TABLE WHERE ROWNUM  < 100;

This fetches 100 records and writes them to a file. When I do this again, it will fetch the same 100 records once again. Is there some way of eliminating the records it has already written?

I thought of creating a table where I will insert the primary key of each record that has been written to a file.
So I will then do

SELECT * FROM TABLE WHERE ROWNUM < 100 AND PRIMARYKEY NOT IN (SELECT PRIMARYKEY FROM ANOTHERTABLE);

I am using Oracle 9i and a console based c# app. I use ODP .NET to make the connection.

Is there any other way to do this process?

  • 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-16T23:31:48+00:00Added an answer on May 16, 2026 at 11:31 pm

    First of all, your select statement should be ordered, otherwise you aren’t guaranteed to get the same 100 rows every time.

    What you could do is have a dynamic query (if you don’t want a stored procedure than just build the string and subsitute :start and :end with actual numeric values before executing the query) that limits rownum, maybe something like:

    select *
    from(
        select table.*, rownum rn
        from table
        where rownum rownum < :end
        order by ID) s
    where s.rn >= :start
    

    UPDATE

    I do agree with Scott Anderson, why not just get all records at once and separate the records into groups of 100’s in your front-end system?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table with 100 records with no PK. I need to add
I have this homework question: Assume a Database table has 0 records at time
I have a table which contains 1000 records. I needed to pull 100 records
I have a simple ActiveRecord model called Student with 100 records in the table.
I have a table with more than 100 columns. I need to join it
How can I return first 100 records using Linq? I have a table with
I have to retrieve the more than 100 records from the Database table using
I have table SR with some records with statuses (more then 5 records this
I have a table which has some 100-200 records. I have fetch those records
Lets say I have a student table and there are 1000 records in it.

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.