我使用的是Oracle SQL Developer 3.0。试图弄清楚如何将查询结果导出到文本文件(最好是CSV)。右键单击查询结果窗口没有提供任何导出选项。
当前回答
从sql developer导出到本地系统。
Path : C:\Source_Table_Extract\des_loan_due_dtls_src_boaf.csv
SPOOL "Path where you want to save the file"
SELECT /*csv*/ * FROM TABLE_NAME;
其他回答
从sql developer导出到本地系统。
Path : C:\Source_Table_Extract\des_loan_due_dtls_src_boaf.csv
SPOOL "Path where you want to save the file"
SELECT /*csv*/ * FROM TABLE_NAME;
CSV导出不会转义您的数据。注意以\结尾的字符串,因为结果的\"看起来像转义的"而不是\。那么你的号码错了,你的整排都坏了。
供您参考,您可以替换/*csv*/ 对于其他格式,包括/*xml*/和/*html*/。 例如,从emp中选择/*xml*/ *将返回一个包含查询结果的xml文档。 在寻找从查询返回xml的简单方法时,我偶然发现了这篇文章。
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.
不完全是“导出”,但您可以在想要导出的网格中选择行(或按Ctrl-A选择所有行),然后用Ctrl-C复制。
默认值是由制表符分隔的。您可以将其粘贴到Excel或其他编辑器中,并随心所欲地操作分隔符。
此外,如果您使用Ctrl-Shift-C而不是Ctrl-C,您还将复制列标题。
推荐文章
- oracle中的RANK()和DENSE_RANK()函数有什么区别?
- 如何加载一个tsv文件到熊猫数据框架?
- 从csv文件创建字典?
- 什么时候我需要在Oracle SQL中使用分号vs斜杠?
- 从url读取csv
- SQLite:如何将查询结果保存为CSV文件?
- 如何从表中导出所有数据到可插入的sql格式?
- Ruby on Rails -从CSV文件导入数据
- 如何在Oracle SQL开发人员中找到引用给定表的表?
- 在PHP中为用户创建一个CSV文件
- read_csv . pandas中的Datetime dtypes
- 使用SQL Server Server Management Studio导入/导出数据库
- 如何在Oracle SQL开发人员中设置自定义日期时间格式?
- 为什么Oracle 9i将空字符串视为NULL?
- 导入CSV文件到SQL Server中