Guide
Exporting Query Results to CSV in Oracle SQL Developer
Learn how to export query results from Oracle SQL Developer to a CSV file using the Export Wizard, with step‑by‑step instructions, verification steps, and recovery tips.
Published by Tasadduq Burney
12 May 2026, 04:01 UTC
3 min82.4K views0

Desired outcome
Save the result set of a SQL query executed in Oracle SQL Developer as a comma‑separated values (CSV) file that can be opened in spreadsheet applications or processed by scripts.
Prerequisites
- Oracle SQL Developer version 4.2 or later installed.
- A database connection with sufficient privileges to run the target query.
- The query already tested in the SQL Worksheet and returning the expected rows.
- Write permission on the filesystem location where the CSV will be saved.
- Enough free disk space for the exported file (estimate based on result set size).
Procedure
- Open SQL Developer and establish the database connection.
- Open a SQL Worksheet (right‑click the connection → Open SQL Worksheet).
- Enter or paste the SQL query you wish to export, for example:
SELECT employee_id, first_name, last_name FROM employees WHERE department_id = 10; - Execute the query (Ctrl+Enter or the Execute Statement button). Verify that the result grid displays the expected rows.
- Right‑click anywhere inside the result grid and choose Export… from the context menu.
- In the Export Wizard dialog:
- Set Format to CSV.
- Choose the delimiter (default is a comma; you may select tab, semicolon, etc.).
- Select the character encoding (usually UTF‑8).
- Specify the full file path, e.g.,
/tmp/emp_dept10.csvorC:\exports\emp_dept10.csv. - Optionally check Include column headers if you want the first line to contain column names.
- Click Next to preview the first few rows.
- Review the preview to ensure column alignment and proper handling of special characters.
- Click Finish to write the CSV file to the specified location.
Verification
- Open the exported CSV file in a plain‑text editor (e.g., Notepad, vim) or a spreadsheet program.
- Confirm that the first line matches the selected column headers (if the header option was enabled).
- Count the lines in the file, excluding the header line if present, and compare that number to the row count shown in SQL Developer’s result grid.
- Spot‑check a few rows for correct delimiter placement and ensure that embedded commas or quotes are properly quoted according to CSV rules.
Recovery options
If the export fails or the produced file is incomplete:
- Re‑run the query in the SQL Worksheet to confirm it still returns data.
- Check that the target directory has sufficient free space and write permissions.
- Retry the Export Wizard, possibly reducing the result set size by adding a WHERE clause or using the wizard’s Limit rows option.
- As a fallback, use SQL*Plus or SQLcl with the
SPOOLcommand to generate a CSV file manually. - If the file was created but contains incorrect data, delete it and repeat the export after correcting the query or export settings.
Limitations and considerations
- Large result sets may consume significant memory during the export; consider limiting rows or exporting in batches.
- CSV export stores data as plain text; Oracle‑specific types such as TIMESTAMP WITH TIME ZONE are converted to their string representation, so verify date formats after export.
- Mismatch between the client character set in SQL Developer and the database character set can lead to garbled characters; ensure they are aligned or explicitly set the encoding in the wizard.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.