Exporting Oracle Table Data via SQL Developer: Choosing Between SQL Inserts and CSV
Learn how to use the SQL Developer Export Wizard to migrate data using SQL Inserts or CSV, including critical warnings about result grid fetching and delimiter collisions.
06 Aug 2026, 12:13 UTC

The Problem: Data Migration vs. Data Analysis
When moving data out of an Oracle database using SQL Developer, the primary challenge is selecting a format that balances data integrity with the destination's ability to process the file. Choosing Insert statements is ideal for migrating small-to-medium datasets between database schemas, while CSV (Comma Separated Values) is the standard for external analysis in tools like Excel or Python.
Mechanism: The Export Wizard
SQL Developer provides an Export Wizard that can be triggered from two different contexts: the Connections Tree (exporting the entire table structure and data) or the Query Result Grid (exporting only the rows returned by a specific SELECT statement).
Worked Configuration: Generating Migration Scripts
To migrate data from a source table to a target table in another schema, use the Insert format. This generates Data Manipulation Language (DML) scripts that recreate the rows exactly as they exist in the source.
- In the Connections pane, right-click the target table name.
- Select Export... from the context menu.
- In the Format dropdown, select
insert. - Ensure the Save As option is set to
Local Fileand provide a.sqlextension. - Click Next to verify the columns being exported, then Finish.
Example Output: If you have a table EMPLOYEES with columns EMP_ID and NAME, the resulting file will contain:
INSERT INTO EMPLOYEES (EMP_ID, NAME) VALUES (101, 'Jane Doe');
INSERT INTO EMPLOYEES (EMP_ID, NAME) VALUES (102, 'John Smith');
COMMIT;
Comparison: Format Selection Matrix
| Format | Best Use Case | Risk | Verification Method |
|---|---|---|---|
| Insert | Schema migration / Backups | File size/Memory limits | Run script in a test schema |
| CSV | Excel / Data Science | Delimiter collisions | Open in text editor to check alignment |
| JSON | Web API integration | Type conversion errors | Validate via JSONLint |
Critical Limitations and Common Mistakes
The "Fetch All" Trap
A common error occurs when exporting from a Query Result Grid. By default, SQL Developer only fetches the first few dozen rows to improve performance. If you export the grid without scrolling to the bottom or clicking the Fetch All button, your export file will be incomplete. To avoid this, export directly from the table object in the Connections tree if you need the entire dataset.
CSV Delimiter Collisions
If your VARCHAR2 columns contain commas and you export as CSV using a comma delimiter, the resulting file will shift columns, corrupting the data. To prevent this, always configure the Enclosure setting (typically double quotes ") in the Export Wizard. This wraps text fields, ensuring that a comma inside a string is treated as data rather than a column separator.
Memory Exhaustion with SQL Inserts
Exporting 100,000+ rows as Insert statements creates a massive text file. Attempting to run this file by dragging it into a SQL Worksheet often leads to OutOfMemoryError because the worksheet tries to load the entire script into the JVM memory. For large datasets, use SQL*Loader or External Tables instead of the Export Wizard.
Verification and Rollback
To verify a CSV export, open the file in a plain text editor (like Notepad++ or VS Code) and check that the number of delimiters per line is consistent. To verify an Insert script, execute it in a development environment and run SELECT COUNT(*) FROM table_name; to ensure the row count matches the source.
Rollback: Because the Export Wizard is a read-only operation on the source database, there is no state to roll back. If you execute the resulting Insert script and need to undo the changes, run DELETE FROM table_name; or DROP TABLE table_name; in the target schema.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.