Export to CSV
The export function for query result is not so obvious for developers to find out. In this post, I will show how to export query result as a CSV file.
Show Query Result as Grid
To show the query result in a grid table, you have to use F9 or Ctrl+Enter to format query result in grid.
Right Click Mouse and Export
Move your cursor over anywhere on the grid and right click the mouse, you will see Export option.
Export Entire Table
If the data you want to export is a table, not a query result, you can directly right-click on the table and select Export in the menu.
Select Export Format
SQL Developer showed Export Wizard window for interaction. Although there're many export types for us to select, we chose CSV format in this case.
Select Line Terminator
This option depends on your requirements. If you're going to use SQL loader in Linux/UNIX, you can select Unix/Mac LF, otherwise Windows CR LF is preferred. By the way, I kept header in this CSV file.
Select Text Encoding
I chose UTF-8 in order to match the database encoding.
If you want to change the path, you can click Browse to navigate and choose a right directory to place.
Review Export Job Before Executing
You can expand all options to see the content of the export job.
Check Content of CSV File
CSV files are also plain text files, so they can be viewed in any text editor below.
In a similar way, we can export query result to an Excel file in SQL Developer.