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?