数据仓库服务 GAUSSDB(DWS)-MERGE INTO:语法格式

时间:2024-12-10 14:36:02

语法格式

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
MERGE [/*+ plan_hint */] INTO table_name [ [ AS ] alias ]
USING { { table_name | view_name } | subquery } [ [ AS ] alias ]
ON ( condition )
[
  WHEN MATCHED THEN
  UPDATE SET { column_name = { expression | DEFAULT } |
          ( column_name [, ...] ) = ( { expression | DEFAULT } [, ...] ) } [, ...]
  [ WHERE condition ]
]
[
  WHEN NOT MATCHED THEN
  INSERT { DEFAULT VALUES |
  [ ( column_name [, ...] ) ] VALUES ( { expression | DEFAULT } [, ...] ) [, ...] [ WHERE condition ] }
];
support.huaweicloud.com/sqlreference-830-dws/dws_06_0235.html