这个错误害我花了一天时间排查,最后原来是因为结束符,这种语句不能是分号,将分号即可执行成功。
MERGE INTO MO_TRADE_COUNT_DAY A USING ( SELECT MAX(flow_id) AS flowId, CHANNEL AS channel, SUM( RESULT ) AS tradeSuccess, COUNT( RESULT ) AS tradeTotal, AVG( RESPONSE_TIME ) AS responseTime, (COUNT( RESULT ) - SUM( RESULT )) AS tradeFail FROM SS_CHANNELFLOW_COUNT WHERE 1 = 1 AND CREATE_TIME >= to_date(‘2020-07-13 00:00:00‘,‘yyyy-mm-dd hh24:mi:ss‘) AND CREATE_TIME <= to_date(‘2020-07-13 23:59:59‘,‘yyyy-mm-dd hh24:mi:ss‘) GROUP BY CHANNEL ) C ON ( A.CHANNEL = C.CHANNEL AND A.CREATE_TIME = to_date(‘2020-07-13 00:00:00‘,‘yyyy-mm-dd hh24:mi:ss‘)) WHEN MATCHED THEN UPDATE SET "TRADE_TOTAL" = C.tradeTotal, "TRADE_SUCCESS" = C.tradeSuccess, "TRADE_FAIL" = C.tradeFail, "RESPONSE_TIME" = C.responseTime WHEN NOT MATCHED THEN INSERT ( "ID", "CHANNEL", "TRADE_TOTAL", "TRADE_SUCCESS", "TRADE_FAIL", "RESPONSE_TIME", "CREATE_TIME" ) VALUES ( C.flowId, C.CHANNEL, C.tradeTotal, C.tradeSuccess, C.tradeFail, C.responseTime, to_date(‘2020-07-13 00:00:00‘,‘yyyy-mm-dd hh24:mi:ss‘)); -- mybatis 上面注意分号