Export data in handy formats using SQLDeveloper

Just a small techtip

Sometimes you want to export table data. SQLDeveloper can help you with that with a few formats which are built-in and are callable via a simple hint within your SQL statement.

Say for example you have an employee table and want to export that data towards Excel via a CSV-file. The only action this takes is writing a SQL statement and adding the hint /*csv*/ to it. When you execute the statement as a script (hotkey F5) SQLDeveloper will export your data as CSV.


The data in the employee table

If we execute the following statement

SELECT /*csv*/ * FROM employee; 

We get

CSV output

With this trick we can get all sorts of formats:

Format codeWill give you
csv / delimitedCSV output (as shown in the example)
xmlXML output
htmlHTML output
insertAn insert script
loaderData in a loader file format
fixedFixed width data
textPlain text format (concatenates everything)

This might make your life easier when you need to quickly export data