Solved

update Oracle table with data from Excel spreadsheet

Posted on 2014-04-16
7
3,316 Views
Last Modified: 2014-04-18
I have an Oracle table that I need to update one column in the table for several thousand rows.  I have the data to do that update in an excel spreadsheet.  How can I update that Oracle table with the data in the excel spreadsheet.  I have the unique identifier in the excel spreadsheet for each table row that needs to be updated.  Thanks for any help that you can give.
0
Comment
Question by:newtoperlpgm
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
7 Comments
 
LVL 77

Accepted Solution

by:
slightwv (䄆 Netminder) earned 500 total points
ID: 40005500
You 'could' write a lot of VBA code but here is what I would do.

Save the Excel spreadsheet as a CSV.
Either use SQL Loader to load the data into a temp table in Oracle or create an External table against the CSV.

Then perform the update from the temp or external table.

There are tons of sql loader and external table examples out there on the web.

Hopefully the update is straight forward.

If you need any help with any of this, please post back with sample data and expected results and what pieces you need help with.
0
 
LVL 22

Expert Comment

by:Steve Wales
ID: 40005505
I have always done something similar in same kind of circumstance.  I have a Delphi piece of template code that opens a spreadsheet and loops through the data and I generate a text file with the insert or update statement then run that through sqlplus.
0
 
LVL 77

Expert Comment

by:slightwv (䄆 Netminder)
ID: 40005513
>>and I generate a text file with the insert or update statement then run that through sqlplus.

Didn't think about brute force.

Alternatives without the delphi piece:

global search and replace from a txt/csv file in notepad.
or
I have seen people insert new columns in Excel with the DML then save to txt and replace the tabs.

For example:
insert columnA and add: update some_table set some_column='
columnB has the value
insert columnC: ' where comeothercolumn='
columnD has the value
Insert columnE ';

then save, repace the tabs for the column breaks and run in sqlplus.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 22

Expert Comment

by:Steve Wales
ID: 40005552
Sometimes the brute force approach is the simplest way to get the job done.

A little effort the first time, then super easy each successive time you need to complete a similar task.
0
 
LVL 77

Expert Comment

by:slightwv (䄆 Netminder)
ID: 40005555
Could not agree more
0
 

Author Comment

by:newtoperlpgm
ID: 40007039
I was able to easily create an Oracle staging table, feed the data into the data from the spreadsheet and update my original table with a simple update statement.  Thanks so much for making it easy for me.
0
 
LVL 77

Expert Comment

by:slightwv (䄆 Netminder)
ID: 40007074
No problem.  Glad to help!
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article started out as an Experts-Exchange question, which then grew into a quick tip to go along with an IOUG presentation for the Collaborate confernce and then later grew again into a full blown article with expanded functionality and legacy…
When it comes to protecting Oracle Database servers and systems, there are a ton of myths out there. Here are the most common.
This video explains at a high level about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.
This video shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…

690 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question