The replace into Mysql

Update (if the primary key is set to auto-grow) and insert (if the primary key is set to auto-grow)

The replace into statements

replace into test set id=2,name='abcd';
replace into test set id=2,name='abcd';
replace into test set id=2,name='abcd';
Copy the code

The merge into oracle

The standard for determining whether data is identical is based on a unique index. Are there alternatives in Oracle? The answer is yes

The merge into statements

merge into 
 test_id a
using 
 (select id , name from test_id ) b
on (a.id = b.id)
 WHEN MATCHED THEN
   UPDATE SET a.name = b.name
 WHEN NOT MATCHED THEN
   INSERT
    (a.id, a.name)
   VALUES
    (b.id, b.name);
Copy the code

conclusion

Mysql’s replace into and Oracle’s merge into syntactic functions are identical

Pay attention to

Oracle merge into needs to be used with using