Skip to Main Content

Database Software

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Merge with MATCHED BY TARGED/MATCHED BY SOURCE syntax

Martin PreissMay 16 2016 — edited May 16 2016

Again an idea for the category "product x has it already". This time product x is the SQL Server: there it has been possible to make a distinction between different kinds of mismatches in a merge since many releases: https://msdn.microsoft.com/de-de/library/bb510625(v=sql.120).aspx

"WHEN NOT MATCHED [ BY TARGET ] THEN <merge_not_matched>

Specifies that a row is inserted into target_table for every row returned by <table_source> ON <merge_search_condition> that does not match a row in target_table, but does satisfy an additional search condition, if present. [...]

WHEN NOT MATCHED BY SOURCE THEN <merge_matched>

Specifies that all rows of target_table that do not match the rows returned by <table_source> ON <merge_search_condition>, and that satisfy any additional search condition, are either updated or deleted according to the <merge_matched> clause."

This would make some data load operations in data warehouses more simple.

Comments
Post Details
Added on May 16 2016
4 comments
7,228 views