I tried google at first but no luck.
Is it possible to update tables from csv file?
I am using SQL developer and I am using a script to export edited rows to a csv file. I would like to update the edited rows through that csv file from a client. I don't want to import the whole file as the client already has a mirror table, I just would like to update the data from what it is in the csv file.
Is this possible?
If not what would be the best approach?
Best Answer
I would suggest you to make use of External Tables. You can create an external table on your CSV file using
ORACLE_LOADER
driver and then update your existing table with data in your external table using DML (MERGE
for example).Consult Oracle Utilities Guide for detailed info.
What follows is my sample of how you can update tables from flat files.
First you create the directory where your flat file will be located:
Then you create your external table:
We'll assume that you already have the table that you want to update with data from the flat file:
(Here, I just loaded it with sample data.)
Now that's what your
info.dat
contains, for example:At this point you will just update your existing table with above data from the external table:
Here's what you'll get as a result: