MergeTableStatement

open class MergeTableStatement(dest: Table, source: Table, on: Op<Boolean>?) : MergeStatement

Represents an SQL MERGE statement. It encapsulates the logic to perform conditional updates, insertions, or deletions.

Here is only the part specific for the Table as a source implementation. Look into MergeStatement to find the base implementation of that command.

Parameters

dest

The destination Table where records will be merged into.

Constructors

Link copied to clipboard
constructor(dest: Table, source: Table, on: Op<Boolean>?)

Properties

Link copied to clipboard

The destination Table where records will be merged into.

Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
open override fun arguments(): Iterable<Iterable<Pair<IColumnType<*>, Any?>>>

Returns all mappings of columns and expression types to their values needed to prepare an SQL statement.

Link copied to clipboard
open override fun prepareSQL(transaction: Transaction, prepared: Boolean): String

Returns the string representation of an SQL statement.

Link copied to clipboard
fun whenMatchedDelete(and: Op<Boolean>? = null)

Specifies a delete operation to be executed when a matching record is found in the destination table.

Link copied to clipboard
fun whenMatchedDoNothing(and: Op<Boolean>? = null)

Postgres only. Specifies that no operation should be performed when a matching record is found in the destination table.

Link copied to clipboard
fun whenMatchedUpdate(and: Op<Boolean>? = null, deleteWhere: Op<Boolean>? = null, body: (UpdateStatement) -> Unit)

Defines an update operation to be executed when a matching record is found in the destination table.

Link copied to clipboard

Postgres only. Specifies that no operation should be performed when no matching record is found in the destination table.

Link copied to clipboard
fun whenNotMatchedInsert(    and: Op<Boolean>? = null,     overridingUserValue: Boolean = false,     overridingSystemValue: Boolean = false,     body: (InsertStatement<Int>) -> Unit)

Defines an insert operation to be performed when there is no matching record in the destination table.