Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

split query result into 2 using rownum

user13118348Mar 31 2011 — edited Mar 31 2011
Hi everyone,

I have an SQL query that return 75000 records. Because client will be viewing these records in excel and excel only open 65K, I have to provide them 2 csv files.

first csv with 65000 records
second csv with 10000 records.

Hre is the CATCH....I have to be able to do this using 2 separate queries.

First query should return 65000 records
Second query should return the remaining 10000 records.

I am using rownum <=60000 in my first query using (order by rownum ASC) and it works
For the remaining 10000 records, I tried rownum <= 10000 order by rownum DESC. I thought this would give me the remaining 10000 but its not. It includes records already appearing in the result of first query.

How can I split the result set in 1 queries. Is there any other way than rownum??

Thanks for your help.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 28 2011
Added on Mar 31 2011
8 comments
4,486 views