Oracle Merge
The Oracle MERGE statement uses to select rows from one or more tables or views for update or insert into a table or view.
Oracle Merge example
MERGE INTO payments p USING new_payments np ON (p.id = np.id) WHEN NOT MATCHED THEN INSERT (p.id, p.amount, p.currency, p.no, p.details) VALUES (np.id, np.amount, np.currency, np.no, np.details); MERGE INTO payments p USING new_payments np ON (p.id = np.id) WHEN NOT MATCHED THEN WHEN MATCHED THEN UPDATE SET p.details = np.details; merge into customers c using (select * from customers_details) cd on (c.customer_id = cd.customer_id) when matched then update set c.email = cd.email when not matched then insert (c.customer_id, c.name, c.email) values(cd.customer_id, cd.name, cd.email);