Oracle 使用MERGE INTO 语句 一条语句搞定新增编辑

MERGE INTO RDP_CHARTS_SETTING T1
USING (SELECT '10001' AS PAGE_ID, 'test' AS CHART_OPTION FROM DUAL) T2
ON (T1.PAGE_ID = T2.PAGE_ID)
WHEN MATCHED THEN
  UPDATE SET T1.CHART_OPTION = T2.CHART_OPTION
WHEN NOT MATCHED THEN
  INSERT
    (T1.PAGE_ID, T1.CHART_OPTION)
  VALUES
    (T2.PAGE_ID, T2.CHART_OPTION);
RDP_CHARTS_SETTING :表
PAGE_ID:字段1
CHART_OPTION:字段2
10001:数据1
test:数据2






posted @ 2019-05-22 11:10  bigroc  阅读(375)  评论(0编辑  收藏  举报