Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Script output to file when using SQL-Developer

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.

like image 246
Laurent K Avatar asked Feb 10 '10 08:02

Laurent K


2 Answers

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.

like image 79
Mike G Avatar answered Sep 17 '22 18:09

Mike G


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"
like image 26
Tech_Coder Avatar answered Sep 20 '22 18:09

Tech_Coder