We love getting enhancement requests from our users. A good deal of the development in SQL Developer is guided by what our users are asking for.

It does pain me a bit though when someone asks for a feature what we already have.

Example:

We frequently have a requirement to export working data (especially for data modeling purposes) to spreadsheets. It would be helpful if SQL Developer export had an option to export all tables to individual spreadsheets, creating one spreadsheet per table. So exporting a schema of 50 tables would create 50 spreadsheets in a single export operation. The spreadsheet name should include the table name. Today the export function does not allow me to export more than one table at a time. For a large schema with many tables, the export schema function would be very handy. The new dialog should allow the user to select one or more tables to export (including an all tables option).

So..

  • export more than 1 table
  • to Excel
  • one file per table
  • default to the table name

I read this as a spreadsheet = an Excel file. If you read it as a one or more worksheets in a single workbook (single Excel FILE), then skip to the bottom, because we support THAT too.

Tools > Database Export

Mind the red-boxed bits. Select a directory, select multiple files, select Excel.
Mind the red-boxed bits. Select a directory, select multiple files, select Excel.
Pick your tables. Pick all of them if you want. Add filters, specify columns...go crazy if you'd like.
Pick your tables. Pick all of them if you want. Add filters, specify columns…go crazy if you’d like.
Again, just confirming what we selected in the first wizard page.
Again, just confirming what we selected in the first wizard page.
The files...
The files…
Ta-da!
Ta-da!

The Filters

You can ‘filter’ out the columns you don’t want to export for each table. Again, we default to grabbing everything. You can add WHERE clause filters for each table – and also preview what that data will look like.

Get just the data you want.
Get just the data you want.

There’s a global where input as well – that will add a ‘WHERE XYZ’ clause to every SELECT we use to grab the data. So if you want to only grab records that have an ID in (1,2,3,4,5) add THAT to your global where.

But Wait, What About Multiple Worksheets in a Single Workbook??

In other words, just one file, and a tab per table?

Yeah, it’ll do that too.

One workbook, multiple worksheets.
One workbook, multiple worksheets.
Ta-da, again.
Ta-da, again.
thatjeffsmith
Author

I'm a Master Product Manager at Oracle for Oracle SQL Developer. My mission is to help you and your company be more efficient with our database tools.

22 Comments

  1. John Cavell Reply

    Hi Jeff

    Is there a way to exclude empty tables from the export, please?

    Thanks
    John

    • John Cavell

      Sorry, I’m not sure what you mean by “empty boxes”…

      To explain – we have a database with more than 2200 tables. We need to analyse the changes to the data that result from running certain business transactions, so we have CDC configured to capture the data changes into a matching set of 2200 “CDC tables”. After the business transactions run there are typically 150 – 200 CDC tables that have records in them – we need to export those tables into Excel files (the rest of the CDC tables are empty).

      So I’m hoping there might be a way to automatically exclude the empty tables from the export – obviously it’s an onerous task to select the 150-odd out of 2200 manually in the “Specify Data” pane – so is it possible to (for example) apply a global where clause that would do the trick? Or any other ideas?

    • thatjeffsmith

      You should look at change data notification and dbms_comparison features in the database – could be much easier than what you’re doing today

      If you only want to export tables to Excel that have records…I would in SQLcl, write a script that loops through the tables gathering row counts, and if > 0 do a spool to CSV

  2. Daniel Wong Reply

    It would be nice if we could export multiple SQL query results in one go instead of multiple table result.
    Looking forward to this feature in next version ~
    Oracle is always doing the best I believe

    Cheers

  3. Jeff,

    This is great!
    Once I choose the options and export it, is there a way the steps can be stored as a single task? Then I would be able to execute that task without having to specify the options again.

    Thanks,
    Ramana

  4. i want to export multiple executed query result in to csv file at a time .. please help me..

    • I tried this out but instead of the query results, I am getting the sql statement itself in the generated csv file. Any idea what might be causing this ?

    • thatjeffsmith

      there’s an option to include the SQL, uncheck that – but, is it Exce XLSX or CSV files?

    • Thanks Jeff for the quick reply. I tried to look for the option to disable the SQL but could not find it. Can you help me with that ?
      Also, the column headers are missing in the output. Any suggestions to fix that would be awesome. I intend to have dat (text) files as the output, one for each query in the script. SQLDev Version 4.0.3.16

    • thatjeffsmith

      >> SQLDev Version 4.0.3.16
      Upgrade dude. We’ve released 4.1.0, 4.1.1, 4.1.2, 4.1.3, 4.1.5, & 4.2.0 since your version.

  5. Would be even better if you could tables from another schema.

    Maybe allow you run something like “ALTER SESSION SET CURRENT_SCHEMA=other_schema;” before searching for objects to export?

    • Just found that you can export tables from another schema.
      Multi-select “Other Users” objects in the browser, right-mouse-click, and select “Export”

      Sorry if this caused you any pain Jeff … I do feel stupid now for asking for a feature what you already have.

    • thatjeffsmith

      Tools > Database > Export..walk the wizard and pull as many tables as you want from one or more schemas. You can also apply filters.

  6. John Garmon Reply

    Wow!

    Your mailing list is SO HELPFUL, and this tip in particular. Some of us don’t have training budgets (or time), and don’t have knowledgeable co-workers to learn from.

    You are the best!

    john3

    • Dang Jeff!
      I just found this and passed it up the chain of command. You may regret the offer! haha
      john3

  7. I think you should mention the export to multiple sheets in one Excel file too. As far as i understand this was what was described in the request, and it’s done simply by choosing “single file” instead of “seperate files” 🙂

Write A Comment