18

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
  • 7
    I guess Microsoft must be using one of those combo hammer/screwdrivers then. (i.e. their GUIs do it....) Commented Sep 8, 2010 at 19:27

4 Answers 4

22

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.

Sign up to request clarification or add additional context in comments.

2 Comments

Note that it needs a recent enough version. Version 3.0.03 doesn't have an Export Data command, while version 3.1.06 does.
It needs two executions. If your request takes hours you are screwed
11

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"

1 Comment

I need csv output but its printing in some other format which is not much readable
6

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).

Comments

0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.