I have an Oracle table which contains a column called dt_code, first_name, last_name, and user_id. I need to update dt_code with a list of codes that was given to me in an excel file. What would be the best way to update the column and maintain the relationships.
Asked
Active
Viewed 45 times
1
-
how many codes are we talking ? if just a few, Jean's answer should work well enough. – Ditto Mar 27 '15 at 15:24
1 Answers
1
as simple as
update your_table
set dt_code = new_code
where id = specific_id;
this won't break any relationships.
Note that Oracle allow you to import xls datas, but since I have no idea of your syntax it is hard to tell you how to do it.
If there is a lot of update to do, you should import all the datas in a temporary table, then do the update based on this table.
If you choose this option and you are not used to this kind of update statement, have a look at this thread Update statement with inner join on Oracle.

Community
- 1
- 1

Jean-François Savard
- 20,626
- 7
- 49
- 76
-
Well, he *could* use Excel to build the Update statements needed, then run them in SQL. Or if there is too many codes, it'll probably be easier loading the data from Excel into a temp table first, then update off that. ;) OP hasn't given us much info to work of (yet) though .. – Ditto Mar 27 '15 at 15:26