提交 2a3b1bac authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Add a test case

上级 edd3da3b
...@@ -114,3 +114,38 @@ DROP TABLE SOURCE_TABLE; ...@@ -114,3 +114,38 @@ DROP TABLE SOURCE_TABLE;
DROP TABLE DEST_TABLE; DROP TABLE DEST_TABLE;
> ok > ok
CREATE TABLE TEST(C1 INT, C2 INT, C3 INT);
> ok
MERGE INTO TEST USING DUAL ON (C1 = 11 AND C2 = 21)
WHEN NOT MATCHED THEN INSERT (C1, C2, C3) VALUES (11, 21, 31)
WHEN MATCHED THEN UPDATE SET C3 = 31;
> update count: 1
MERGE INTO TEST USING DUAL ON (C1 = 11 AND C2 = 22)
WHEN NOT MATCHED THEN INSERT (C1, C2, C3) VALUES (11, 22, 32)
WHEN MATCHED THEN UPDATE SET C3 = 32;
> update count: 1
SELECT * FROM TEST ORDER BY C1, C2;
> C1 C2 C3
> -- -- --
> 11 21 31
> 11 22 32
> rows (ordered): 2
MERGE INTO TEST USING DUAL ON (C1 = 11 AND C2 = 21)
WHEN NOT MATCHED THEN INSERT (C1, C2, C3) VALUES (11, 21, 33)
WHEN MATCHED THEN UPDATE SET C3 = 33;
> update count: 1
SELECT * FROM TEST ORDER BY C1, C2;
> C1 C2 C3
> -- -- --
> 11 21 33
> 11 22 32
> rows (ordered): 2
DROP TABLE TEST;
> ok
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论