2

I have 50 tables on a schema on Oracle server. Each table has roughly 1 million rows. I want to export all tables to separate excel files. I only need 10 rows for each table. I know I can select 10 rows and manually export it to excel file one by one. Is there any way to set exporting only 10 rows in Export Wizard, and export 50 tables to separate excel files in batch (automatically)? Thanks.

1
  • I removed the Excel tag, since Excel is not the tool, only the recipient.
    – teylyn
    Commented Sep 12, 2019 at 1:39

2 Answers 2

11

Tools - Database Export

enter image description here

Note the output type is set to Separate Files and we're pointing to a directory.

If you set it to a single file, you'll get one excel file with 50 worksheets.

Pick your tables, and set GLOBAL WHERE CLAUSE

Click Next, then Finish, and you're off to the races.

enter image description here

4
  • Cool, great to hear that @Michael, now just mark my answer as 'Correct' -> and welcome to StackOverflow! Commented Sep 12, 2019 at 16:49
  • Sir, Another question. Is it possible to transpose all these tables when exporting to excel files?
    – Michael
    Commented Sep 12, 2019 at 17:40
  • I am new here, could you tell me how to make your answer as "correct"?
    – Michael
    Commented Sep 12, 2019 at 17:41
  • Just click the checkmark toggle next to the answer that helped you Commented Sep 12, 2019 at 18:20
0

This is not exactly what you asked, but when I asked Google a similar question I ended up here so I figured I'd add what I did to help the next person.

If you want to see an INSERT for one or many rows in SQL Developer:

  1. Tools > Database Export

    Database Export Location

  2. Select your connection, Uncheck Export DDL & Change "Save As" to "Worksheet"

    Export Source Settings

  3. On "Types to Export" select Tables only

    Types to Export Settings

  4. On "Specify Data" Type the name of your Table in "Name", then click "Lookup"

    Specify Data 1

  5. Click your table then move it down

    Specify Data 2

  6. Click The empty Object Where space next to the Database Object:

    Specify Data 3

  7. Click the Pencil

    Specify Data 4

  8. This will bring up the Data Where Window (I have blocked my data just in case). Click into the Object Where text input:

    Data Where 1

  9. Enter your clause that will match whatever rows you want to see the INSERT statement for. For me it was PROC_ID=0000.

  10. Click Refresh and a list of your rows should appear. Check to make sure your WHERE got the correct tables.

  11. Click OK, Next, then Finish and you should get a new worksheet with the insert command. If it's not what you expected try different WHERE clauses.


My case was a little different. I wanted to just get the INSERT for one row in a complex table. Then I'll use the INSERT as a template for adding new rows. And since I'm doing this, it's better for me to get it in SQL Developer instead of separate files.

Thanks to @thatjeffsmith for steering me in the right direction.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.