How to export query result to csv in Oracle SQL Developer?

I'm using Oracle SQL Developer 3.0. Trying to figure out how to export a query result to a text file (preferably CSV). Right clicking on the query results window doesn't give me any export options.


Version I am using

替代文字

Update 5th May 2012

Jeff Smith has blogged showing, what I believe is the superior method to get CSV output from SQL Developer. Jeff's method is shown as Method 1 below:

Method 1

Add the comment /*csv*/ to your SQL query and run the query as a script (using F5 or the 2nd execution button on the worksheet toolbar)

在这里输入图像描述

That's it.

Method 2

Run a query

替代文字

Right click and select unload.

Update. In Sql Developer Version 3.0.04 unload has been changed to export Thanks to Janis Peisenieks for pointing this out

替代文字

Revised screen shot for SQL Developer Version 3.0.04

在这里输入图像描述

From the format drop down select CSV

替代文字

And follow the rest of the on screen instructions.


Not exactly "exporting," but you can select the rows (or Ctrl-A to select all of them) in the grid you'd like to export, and then copy with Ctrl-C.

The default is tab-delimited. You can paste that into Excel or some other editor and manipulate the delimiters all you like.

Also, if you use Ctrl-Shift-C instead of Ctrl-C, you'll also copy the column headers.


FYI, you can substitute the /*csv*/ for other formats as well including /*xml*/ and /*html*/ . select /*xml*/ * from emp would return an xml document with the query results for example. I came across this article while looking for an easy way to return xml from a query.

链接地址: http://www.djcxy.com/p/83730.html

上一篇: 关系(ER)图使用Oracle SQL Developer

下一篇: 如何在Oracle SQL Developer中将查询结果导出到csv?