MERGE INTO
create table mytab (id int);
MERGE INTO mytab t USING (SELECT 1 as key) s ON s.key = t.id WHEN MATCHED THEN DELETE;
MERGE INTO mytab t USING (SELECT 1 as key) s ON s.key = t.id WHEN not MATCHED THEN insert values (s.key);
MERGE INTO mytab t USING (SELECT 1 as key) s ON s.key = t.id WHEN not MATCHED THEN insert values (s.key) WHEN MATCHED THEN UPDATE set id = id +1;