While Loading from Source to Target its not necessary that all the records are fresh inserts. For example when we load the data for the transactions table there will be both insert as well as Updates. There will both new transactions as well as old transactions to be updated. If ETL tool is Informatica, we can use Update strategy for implementing both Inserts and Updates. The same we can implement using MERGE SQL statement. Now we will see how we can use MERGE for Update and Insert Process:
Insert will insert the entire record from new Customer table into the actual customer table. Update will update the columns loc and name for all those record which already exists in the customer table.
In cases where we don’t want insert to happen in the target table and only updates then in such case we can omit the Insert clause from the MERGE statement. And in cases where we need only insert to happen then we can omit the Update clause.