1

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.

KinsDotNet
  • 1,500
  • 5
  • 25
  • 53

1 Answers1

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