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.
相关问题
- sqlyog export query result as csv
- Can I skip certificate verification oracle utl_htt
- how to calculate sum time with data type char in o
- keeping one connection to DB or opening closing pe
- System.Data.OracleClient not working with 64 bit O
相关文章
- node连接远程oracle报错
- oracle 11g expdp导出作业调用失败,提示丢包。
- 执行一复杂的SQL语句效率高,还是执行多少简单的语句效率高
- How to read local csv file in client side javascri
- Oracle equivalent of PostgreSQL INSERT…RETURNING *
- Difference between FOR UPDATE OF and FOR UPDATE
- Symfony : Doctrine data fixture : how to handle la
- How to prevent excel from truncating numbers in a
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.
CSV Export does not escape your data. Watch out for strings which end in
\
because the resulting\"
will look like an escaped"
and not a\
. Then you have the wrong number of"
and your entire row is broken.FYI to anyone who runs into problems, there is a bug in CSV timestamp export that I just spent a few hours working around. Some fields I needed to export were of type timestamp. It appears the CSV export option even in the current version (3.0.04 as of this posting) fails to put the grouping symbols around timestamps. Very frustrating since spaces in the timestamps broke my import. The best workaround I found was to write my query with a TO_CHAR() on all my timestamps, which yields the correct output, albeit with a little more work. I hope this saves someone some time or gets Oracle on the ball with their next release.
To take an export to your local system from sql developer.
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.