Merge - performs insert, update, or delete operations on a target table based on the results of a join with a source table.
MERGE <target_table> [AS TARGET]
USING <table_source> [AS SOURCE]
ON <search_condition>
[WHEN MATCHED –exists in the 2 tables (update)
THEN <merge_matched> ]
[WHEN NOT MATCHED [BY TARGET] –not exists in the target table (insert)
THEN <merge_not_matched> ]
[WHEN NOT MATCHED BY SOURCE –not exists in the source table (delete)
THEN <merge_ matched> ];
ON <search_condition>
[WHEN MATCHED –exists in the 2 tables (update)
THEN <merge_matched> ]
[WHEN NOT MATCHED [BY TARGET] –not exists in the target table (insert)
THEN <merge_not_matched> ]
[WHEN NOT MATCHED BY SOURCE –not exists in the source table (delete)
THEN <merge_ matched> ];
No comments:
Post a Comment