次の2つのテーブルを定義するとします。
CREATE SET TABLE testing.t21 ( a INTEGER, b DATE FORMAT 'YY/MM/DD', c DATE FORMAT 'YY/MM/DD') PRIMARY INDEX (a); CREATE SET TABLE testing.t22 ( a INTEGER, b PERIOD (DATE)) PRIMARY INDEX (a) PARTITION BY (CASE_N((END(b))<= DATE '2008-03-31', (END(b))<= DATE '2008-06-30', (END(b))<= DATE '2008-09-30', (END(b))<= DATE '2008-12-31'), CASE_N((BEGIN(b))> DATE '2008-12-31') (BEGIN(b))> DATE '2008-09-30', (BEGIN(b))> DATE '2008-06-30', (BEGIN(b))> DATE '2008-03-31',);
以下のMERGEリクエストで、t11からt22へマージします。
MERGE INTO t22 USING t21 ON t22.a = t21.a AND BEGIN(t22.b) = t21.b AND END(t22.b) = t21.c WHEN MATCHED THEN UPDATE SET c=4 WHEN NOT MATCHED THEN INSERT VALUES (t21.a, PERIOD(t21.b, t21.c), 4);