Top Description
org.jooq

public Interface Merge<R extends org.jooq.Record>

extends DMLQuery<R extends Record>
Known Direct Subinterfaces
org.jooq.MergeFinalStep
Imports
org.jooq.impl.DSL

A MERGE statement.

Example:


// Assuming import static org.jooq.impl.DSL.*;

using(configuration)
   .mergeInto(CUSTOMER)
   .using(selectFrom(CUSTOMER_IMPORT))
   .on(CUSTOMER.ID.eq(CUSTOMER_IMPORT.ID))
   .whenMatchedThenUpdate()
   .set(CUSTOMER.FIRST_NAME, CUSTOMER_IMPORT.FIRST_NAME)
   .set(CUSTOMER.LAST_NAME, CUSTOMER_IMPORT.LAST_NAME)
   .whenNotMatchedThenInsert(CUSTOMER.FIRST_NAME, CUSTOMER.LAST_NAME)
   .values(CUSTOMER_IMPORT.FIRST_NAME, CUSTOMER_IMPORT.LAST_NAME)
   .execute();

Instances can be created using DSL#mergeInto(Table) and overloads.

Author
Lukas Eder