What is the command sequence for replacing values in table a with values in table b?
By submitting your personal information, you agree that TechTarget and its partners may contact you regarding relevant content, products and special offers.
If the two tables are identical, and you want to completely replace contents of table a with table b, you could write a simple procedure to do the following steps:
- DELETE or TRUNCATE table A
- INSERT INTO table A SELECT * FROM table B
CREATE TABLE A as SELECT * FROM table B ;
- Match all the rows of table B to their associated row (by key value) in table A
- When a match is found, replace the column values in table A with the values in table B
For More Information
- Dozens more answers to tough Oracle questions from Karen Morton are available.
- The Best Oracle Web Links: tips, tutorials, scripts, and more.
- Have an Oracle or SQL tip to offer your fellow DBAs and developers? The best tips submitted will receive a cool prize. Submit your tip today!
- Ask your technical Oracle and SQL questions -- or help out your peers by answering them -- in our live discussion forums.
- Ask the Experts yourself: Our SQL, database design, Oracle, SQL Server, DB2, metadata, object-oriented and data warehousing gurus are waiting to answer your toughest questions.
Dig Deeper on Oracle and SQL
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.