Back to Exposed

insert

docs/api/exposed-jdbc/org.jetbrains.exposed.v1.jdbc/insert.html

1.2.01.9 KB
Original Source

insert

fun <T : Table> T.insert(body: T.(InsertStatement<Number>) -> Unit): InsertStatement<Number>

Represents the SQL statement that inserts a new row into a table.

Samples

org.jetbrains.exposed.v1.tests.h2.H2Tests.insertInH2


fun <T : Table> T.insert(selectQuery: AbstractQuery<*>, columns: List<Column<*>>? = null): Int?

Represents the SQL statement that uses data retrieved from a selectQuery to insert new rows into a table.

Return

The number of inserted rows, or null if nothing was retrieved after statement execution.

Parameters

selectQuery

Source SELECT query that provides the values to insert.

columns

Columns to insert the values into. This defaults to all columns in the table that are not auto-increment columns without a valid sequence to generate new values.

Samples

org.jetbrains.exposed.v1.tests.shared.dml.InsertSelectTests.testInsertSelect04

Generated by Dokka © 2026 Copyright