How to Export Query Results to a CSV File in SQL Developer (Oracle)

You can do this to export your query results to a CSV file when using SQL Developer to query Oracle Database.

Run the query, then right-click on the results and select Export...:

Screenshot of the popup menu after right clicking on the query results

That opens the following Export Wizard:

Screenshot of Step 1 of the Export Wizard

Complete the form as required. In particular, be sure to select csv from the dropdown list (otherwise it might default to insert and produce a CSV file full of INSERT statements).

Also be sure to select an appropriate location and file name.

Once done, click Next >.

This opens Step 2 of the Export Wizard:

You can check everything by expanding the various nodes. Feel free to click <Back if you need to change anything.

If it all looks good, click Finish.

Once you’ve done that, the file will be exported to your chosen location.

Here’s what the contents of my file looks like:

"EMPLOYEE_ID","FIRST_NAME","LAST_NAME","SALARY","JOB_TITLE"
145,"John","Russell",14000,"Sales Manager"
146,"Karen","Partners",13500,"Sales Manager"
201,"Michael","Hartstein",13000,"Marketing Manager"
147,"Alberto","Errazuriz",12000,"Sales Manager"
205,"Shelley","Higgins",12000,"Accounting Manager"
108,"Nancy","Greenberg",12000,"Finance Manager"

The CSV file contains headers as specified, and strings are surrounded by double quotes as specified.