0
votes

I am trying to export multiple tables to individual excel files (approximately 120 tables need to be exported) in PLSQL Developer. As of right now, I am running through this process

Run Query

SELECT * FROM TABLE;

From the result window, click "Export Query Results" and save as .xlsx.

This is a lengthy process, and takes around a minute per table (lots of information!), I can't help but think there has to be an easier, more efficient way of doing this. I just can't find any information.

2
what database? your db must have an export commandDarshan Chaudhary
@DarshanChaudhary, I'm two weeks into my first job and I'm honestly not sure how to figure that out. I've never worked with exporting tables in PL/SQL or SQL in general.Amber Rebecca Howe
From the plsqldeveloper tag, can I take it this is Oracle and you are using the PL/SQL Developer desktop IDE? If so, do you want 120 Excel files for your 120 tables, or would another format do?William Robertson
yes, it is oracle. I have added a tag, in case that helps more people come across this. @WilliamRobertson, I have completed exporting the tables individually in the background of my work, but yes they would have to be excel files or at least a similar type of file.Amber Rebecca Howe
PHP - Got PHPExcel and also access to an oracle database. Start writing a scriptEd Heal

2 Answers

1
votes

I don't know which version of PL/SQL Developer you're working with but, in mine, i can run several selects ate the same time and several tabs will open as result.

When i right click the upper left corner of the results, it gives me an option to "Copy to Excel" and then "Copy all as xlsx".

This worked just fine for me.

-2
votes

Use this command:

COPY persons TO '<file path>' DELIMITER ',' CSV HEADER;

example:

COPY persons TO 'C:\tmp\persons_db.csv' DELIMITER ',' CSV HEADER;

ref: http://www.postgresqltutorial.com/export-postgresql-table-to-csv-file/