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

  • Home
  • SEARCH
  • 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 7024613
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T23:51:51+00:00 2026-05-27T23:51:51+00:00

I had to copy the data from oracle tables to files. I have a

  • 0

I had to copy the data from oracle tables to files.

I have a join query which fetches 800k records so i used row_number() function along with order by clause to generate 4 files containing 200k each.

Query :

SELECT * FROM (
    SELECT  ROW_NUMBER() OVER ( order by FILE_KEY desc ) rn,
        FILE_KEY, ROUTING_NO, INTLROUT_TYPE, ABBR_COUNTRY_CODE_2D, HO_CATALOG_NO 
    FROM BANK_INTL_ROUT_TBL rout, BANK_INTL_LOC_TBL loc 
    WHERE loc.CATALOG_NO = rout.FILE_KEY) 
WHERE rn BETWEEN start AND end;

Parameters:

For 1st File  : start =1 ,end = 200000
For 2nd File  : start =200001 ,end = 400000
For 3rd File  : start =400001 ,end = 600000
For 4th File  : start =600001 ,end = 800000

But when i checked last 10 row using this query in sql query browser and last 10 rows of file are different that is sequence is different in file and sql query browser.

SELECT * FROM (
    SELECT  ROW_NUMBER() OVER(  order by FILE_KEY desc ) rn,
        FILE_KEY,ROUTING_NO,INTLROUT_TYPE,ABBR_COUNTRY_CODE_2D,HO_CATALOG_NO 
    FROM BANK_INTL_ROUT_TBL rout, BANK_INTL_LOC_TBL loc 
    WHERE loc.CATALOG_NO=rout.FILE_KEY) 
WHERE rn BETWEEN 709990 AND 80000;
  • 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-27T23:51:51+00:00Added an answer on May 27, 2026 at 11:51 pm

    This can be because you have something like this

    row_number file_key 
    799998     same_number
    799999     same_number
    800000     same_number
    800001     same_number
    800002     same_number
    800003     same_number
    800004     same_number
    

    because you order by file_key.

    How do you observed that are different data? from your other columns. So, you can use:

    SELECT  ROW_NUMBER() OVER(order by FILE_KEY desc, ROUTING_NO, INTLROUT_TYPE, ABBR_COUNTRY_CODE_2D, HO_CATALOG_NO ) rn
    

    Or(second cause), your base table had been changen between your querys.

    UDPDATE: you can use the use_hash hint to speed up your query. 5 hours is too much for this query.

    SELECT * FROM (
        SELECT  /*+use_hash(rout loc)*/
            ROW_NUMBER() OVER(order by FILE_KEY desc, ROUTING_NO, INTLROUT_TYPE, ABBR_COUNTRY_CODE_2D, HO_CATALOG_NO ) rn,
            FILE_KEY, ROUTING_NO, INTLROUT_TYPE, ABBR_COUNTRY_CODE_2D, HO_CATALOG_NO 
        FROM BANK_INTL_ROUT_TBL rout, BANK_INTL_LOC_TBL loc 
        WHERE loc.CATALOG_NO = rout.FILE_KEY) 
    WHERE rn BETWEEN start AND end;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I had written program which copy data into txt file program is given below
My company purchased Visual Studio Pro 2008 last year, which had a 'free' copy
I'm trying to write a stored procedure to copy a subset of data from
I am trying to copy a database with huge data from SQL Server 2005
I have a program that load data from a file using std::ifstream and store
I need to create a Chart which will grab data from external sources when
I have an application which logs changes to records in the production table to
A project I'm working on fetches data from a 3rd party service and caches
I have code which gets frames from a camera and then saves it to
I had a msdn registered copy of Expression Studio installed on my machine and

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.