Updating one column table another column
But Sales Supplier, Purchase supplier, Wholesale Supplier ..many other columns how can i update in single SQL ( I have to update around 70 columns and some columns may have null values such as Purchase supplier ..)2. You need to have the table you are updating from have a unique or primary key constraint.
Secondly you have shown me to update table with "KEY PRESERVED" method. IT NEEDS THIS LOGICALLY regardless of the method used, so just add it (for if a row in OLD joins to more than one row in NEW -- you are hosed, you cannot update this data, therefore NEW has a unique/primary key, add it to facilitate the update) I had a similiar query and i tried applying to my tables.
Asked: June 28, 2005 - am UTC Answered by: Tom Kyte - Last updated: June 18, 2013 - pm UTC Category: Database - Version: 9.2 Viewed 100K times! I want to write SQL ( not PL/SQL ) to update transaction table from mapping table at one stroke. regards & thankspjp update ( select old.old_account_number, new.new_account_number from old_table old, mapping_table new where old.old_account_number = new.new_account_number ) set old_account_number = new_account_number;disabling foreign keys during the operation and enabling them afterward.
This question is Hi Tom, Due to migration to new system we have to change all our account numbers. Don't you mean....update ( select old.old_account_number, new.new_account_number from old_table old, mapping_table new where old.old_account_number = new.old_account_number ) set old_account_number = new_account_number;(ie in the subquery, match the old account numbers not try matching the old in the old table to the new in the mapping table)Of course if the original posting had the CREATEs/INSERTS etc, it would have a quick and east test.
If you update values in multiple columns, you use a comma (,) to separate each pair of column and value.You can also perform more complicated updates in Oracle.You may wish to update records in one table based on values in another table.The columns that are not on the list retain their original values.The Ask TOM team will be busy at Open World this month. WORKEXTENSION from TBL_VOTERS old, VOTERSWITHNUMBERS new where old.