merge into test_table t1 using (select 'zhangsan' username,'/root/test' path, 'this is test' description from dual) t2 on (t1.path = t2.path) when matched then update set t1.path = t2.path, t1.username = t2.username, t1.description = t2.description when not matched then insert (path, username, description) values (t2.path, t2.username, t2.description)