Updated on 2026-08-13 GMT+08:00

MERGE INTO

Function

Synchronizes data in the destination table with that in the source table based on specified conditions.

Syntax Format Supported for Lineage Parsing

MERGE INTO {schema_name}.{table_name1} USING {schema_name}.{table_name2} ON (condition)

Example Statement

MERGE INTO mySchema.target t USING mySchema.source s ON (t.a = s.a) WHEN MATCHED THEN UPDATE SET t.b = t.b + 1 WHEN NOT MATCHED THEN INSERT VALUES (s.a, s.b) WHERE s.b % 2 = 0;