Script output to file when using SQL-Developer

孤街浪徒 提交于 2019-12-06 18:31:19

问题


I have a select query producing a big output and I want to execute it in sqldeveloper, and get all the results into a file.

Sql-developer does not allow a result bigger than 5000 lines, and I have 100 000 lines to fetch...

I know i could use SQL+, but let's assume I want to do this in sqldeveloper.


回答1:


Instead of using Run Script (F5), use Run Statement (Ctrl+Enter). Run Statement fetches 50 records at a time and displays them as you scroll through the results...but you can save the entire output to a file by right-clicking over the results and selecting Export Data -> csv/html/etc.

I'm a newbie SQLDeveloper user, so if there is a better way please let me know.




回答2:


Yes you can increase the size of the Worksheet by change the setting Tool-->Preferences - >Database -> Worksheet -> Max rows to print in a script(depends on you).




回答3:


This question is really old, but posting this so it might help someone with a similar issue.

You can store your query in a query.sql file and and run it as a script. Here is a sample query.sql:

spool "C:\path\query_result.txt";
select * from my_table;
spool off;

In oracle sql developer you can just run this script like this and you should be able to get the result in your query_result.txt file.

@"C:\Path\to\script.sql"



回答4:


Mike G answer will work if you only want the output of a single statement.

However, if you want the output of a whole sql script with several statements, SQL*Plus reports, and some other output formats, you can use the spool command the same way as it is used in SQL*Plus.



来源:https://stackoverflow.com/questions/2235358/script-output-to-file-when-using-sql-developer

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!