Nirpeksh
Nirpeksh

Reputation: 99

How to export more than 200000 records from a table to CSV in SQLDeveloper

I have a query which has close to 2000000 records in the table . I want to export all these records from Table to a CSV file . But the CSV file is allowing me only a max of 200000 files at a time . My ultimate goal is to take all these records and form a dataframe in R for further analysis.

Upvotes: 1

Views: 3833

Answers (1)

thatjeffsmith
thatjeffsmith

Reputation: 22467

SQL Developer has no limit on the size of the CSV we export.

Here's an example of a table to CSV to 2,500,000 records.

CREATE TABLE so_2m (
       x   INT,
       y   DATE
);

BEGIN
       FOR i IN 1..2500000 LOOP
              INSERT INTO so_2m VALUES (
                     i,
                     SYSDATE
              );

       END LOOP;
END;
/

commit;

select count(*) from so_2m;

Table SO_2M created.


PL/SQL procedure successfully completed.


Commit complete.


  COUNT(*)
----------
   2500000

And now let's query and export to CSV

enter image description here

And now let's watch the export and then do a count of lines in the file.

My CSV has 2,500,001 lines. The first line is the Header list of column names.

enter image description here

My 2018 Mac Mini with Oracle VirtualBox running Database 18c EE and SQL Developer version 18.4 generated this file in about 2 minutes.

Upvotes: 1

Related Questions