日期:2014-05-16 浏览次数:20459 次
对于有重复记录的情况下应用,话不多说,直接上语句:
MERGE INTO t_trace_coin_stat_temp temp USING (SELECT '13851430000' as send_terminal_id FROM dual) lg ON (temp.terminal_id = lg.send_terminal_id) WHEN MATCHED THEN UPDATE SET temp.cur_mth_send_cnt = temp.cur_mth_send_cnt + 1, temp.left_cnt = temp.left_cnt + 1 WHEN NOT MATCHED THEN INSERT VALUES (lg.send_terminal_id, 1, 0, 1, to_char(SYSDATE, 'yyyymmddhh24miss'));
?