MERGE STATEMENTS

MERGE Syntax

A MERGE STATEMENT is a combination of INSERT, UPDATE AND DELETE STATEMENT.

When the primary keys match, the data is updated and when there is no match, the data can then be inserted.

Use the MERGE statement to select rows from one or more sources for update or insertion into a table or view. You can specify conditions to determine whether to update or insert into the target table or view.

Merge Update Clause

Merge Insert Clause

Error Logging Clause

Example 1

Example 2

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top