# Dual

object Dual : Table

Represents a special dummy `DUAL` table that is accessible by all users.

This can be useful when needing to execute queries that do not rely on a specific table object. Note: `DUAL` tables are only automatically supported by Oracle. Please check the documentation.

## Properties

autoIncColumn
Link copied to clipboard
val autoIncColumn: Column<*>?

Returns the first auto-increment column on the table.

columns
Link copied to clipboard
open override val columns: List<Column<*>>

Returns all the columns defined on the table.

ddl
Link copied to clipboard
open val ddl: List<String>

Returns the list of DDL statements that create this DdlAware instance.

fields
Link copied to clipboard
open override val fields: List<Expression<*>>

Returns the field of this field set.

foreignKeys
Link copied to clipboard
val foreignKeys: List<ForeignKeyConstraint>

Returns all foreign key constraints declared on the table.

indices
Link copied to clipboard
val indices: List<Index>

Returns all indices declared on the table.

primaryKey
Link copied to clipboard
open val primaryKey: Table.PrimaryKey? = null

Returns the primary key of the table if present, `null` otherwise.

realFields
Link copied to clipboard
open val realFields: List<Expression<*>>

Returns all real fields, unrolling composite CompositeColumn if present

schemaName
Link copied to clipboard
val schemaName: String?

Returns the schema name, or null if one does not exist for this table.

sequences
Link copied to clipboard
val sequences: List<Sequence>

Returns all sequences declared on the table, along with any auto-generated sequences that are not explicitly declared by the user but associated with the table.

source
Link copied to clipboard
open override val source: ColumnSet

Return the column set that contains this field set.

tableName
Link copied to clipboard
open val tableName: String

Returns the table name.

## Functions

array
Link copied to clipboard
inline fun <E : Any> array(name: String, maximumCardinality: Int? = null): Column<List<E>>

Creates an array column, with the specified name, for storing elements of a `List`.

fun <E> array(name: String, columnType: ColumnType<E & Any>, maximumCardinality: Int? = null): Column<List<E>>

Creates an array column, with the specified name, for storing elements of a `List` using a base columnType.

inline fun <T : Any, R : List<Any>> Table.array(name: String, maximumCardinality: List<Int>? = null, dimensions: Int): Column<R>
fun <E, R : List<Any?>> Table.array(name: String, columnType: ColumnType<E & Any>, maximumCardinality: List<Int>? = null, dimensions: Int): Column<R>

Creates a multi-dimensional array column, with the specified name, for storing elements of a nested `List`. The number of dimensions is specified by the dimensions parameter.

array
Link copied to clipboard
inline fun <T : Any, R : List<Any>> Table.array(name: String, maximumCardinality: List<Int>? = null, dimensions: Int): Column<R>
fun <E, R : List<Any?>> Table.array(name: String, columnType: ColumnType<E & Any>, maximumCardinality: List<Int>? = null, dimensions: Int): Column<R>

Creates a multi-dimensional array column, with the specified name, for storing elements of a nested `List`. The number of dimensions is specified by the dimensions parameter.

autoGenerate
Link copied to clipboard
fun Column<UUID>.autoGenerate(): Column<UUID>

UUID column will auto generate its value on a client side just before an insert.

autoinc
Link copied to clipboard
fun <N : Any> Column<EntityID<N>>.autoinc(idSeqName: String? = null): Column<EntityID<N>>
autoIncrement
Link copied to clipboard
fun <N : Any> Column<N>.autoIncrement(idSeqName: String? = null): Column<N>

Make @receiver column an auto-increment column to generate its values in a database. Note: Only integer and long columns are supported (signed and unsigned types). Some databases, like PostgreSQL, support auto-increment via sequences. In this case a name should be provided using the idSeqName param and Exposed will create a sequence. If a sequence already exists in the database just use its name in idSeqName.

fun <N : Any> Column<N>.autoIncrement(sequence: Sequence): Column<N>

Make @receiver column an auto-increment column to generate its values in a database. Note: Only integer and long columns are supported (signed and unsigned types). Some databases, like PostgreSQL, support auto-increment via sequences. In this case, a sequence should be provided using the sequence param.

binary
Link copied to clipboard
fun binary(name: String): Column<ByteArray>

Creates a binary column, with the specified name, for storing byte arrays of arbitrary size.

fun binary(name: String, length: Int): Column<ByteArray>

Creates a binary column, with the specified name, for storing byte arrays with the specified maximum length.

blob
Link copied to clipboard
fun blob(name: String, useObjectIdentifier: Boolean = false): Column<ExposedBlob>

Creates a binary column, with the specified name, for storing BLOBs. If useObjectIdentifier is `true`, then the column will use the `OID` type on PostgreSQL for storing large binary objects. The parameter must not be `true` for other databases.

bool
Link copied to clipboard
fun bool(name: String): Column<Boolean>

Creates a column, with the specified name, for storing boolean values.

byte
Link copied to clipboard
fun byte(name: String): Column<Byte>

Creates a numeric column, with the specified name, for storing 1-byte integers.

char
Link copied to clipboard
fun char(name: String): Column<Char>

Creates a character column, with the specified name, for storing single characters.

fun char(name: String, length: Int, collate: String? = null): Column<String>

Creates a character column, with the specified name, for storing strings with the specified length using the specified text collate type. If no collate type is specified then the database default is used.

check
Link copied to clipboard
fun check(name: String = "", op: SqlExpressionBuilder.() -> Op<Boolean>)

Creates a check constraint in this table.

fun <T> Column<T>.check(name: String = "", op: SqlExpressionBuilder.(Column<T>) -> Op<Boolean>): Column<T>

Creates a check constraint in this column.

clientDefault
Link copied to clipboard
fun <T> Column<T>.clientDefault(defaultValue: () -> T): Column<T>

Sets the default value for this column in the client side.

createStatement
Link copied to clipboard
open override fun createStatement(): List<String>

Returns the list of DDL statements that create this object.

crossJoin
Link copied to clipboard
open infix override fun crossJoin(otherTable: ColumnSet): Join

Creates a cross join relation with otherTable.

customEnumeration
Link copied to clipboard
fun <T : Enum<T>> customEnumeration(name: String, sql: String? = null, fromDb: (Any) -> T, toDb: (T) -> Any): Column<T>

Creates an enumeration column, with the custom SQL type sql, for storing enums of type T using this database-specific type.

databaseGenerated
Link copied to clipboard
fun <T> Column<T>.databaseGenerated(): Column<T>

Marks a column as `databaseGenerated` if the default value of the column is not known at the time of table creation and/or if it depends on other columns. It makes it possible to omit setting it when inserting a new record, without getting an error. The value for the column can be set by creating a TRIGGER or with a DEFAULT clause or by using GENERATED ALWAYS AS via Column.withDefinition, for example.

decimal
Link copied to clipboard
fun decimal(name: String, precision: Int, scale: Int): Column<BigDecimal>

Creates a numeric column, with the specified name, for storing numbers with the specified precision and scale.

default
Link copied to clipboard
fun <T> Column<T>.default(defaultValue: T): Column<T>
fun <T> CompositeColumn<T>.default(defaultValue: T): CompositeColumn<T>

Sets the default value for this column in the database side.

defaultExpression
Link copied to clipboard
fun <T> Column<T>.defaultExpression(defaultValue: Expression<T>): Column<T>

Sets the default value for this column in the database side.

deleteAll
Link copied to clipboard
fun Table.deleteAll(): Int

Represents the SQL statement that deletes all rows in a table.

describe
Link copied to clipboard
open override fun describe(s: Transaction, queryBuilder: QueryBuilder)

Appends the SQL representation of this column set to the specified queryBuilder.

double
Link copied to clipboard
fun double(name: String): Column<Double>

Creates a numeric column, with the specified name, for storing 8-byte (double precision) floating-point numbers.

dropStatement
Link copied to clipboard
open override fun dropStatement(): List<String>

Returns the list of DDL statements that drops this object.

entityId
Link copied to clipboard
fun <T : Any> Column<T>.entityId(): Column<EntityID<T>>

Converts the @receiver column to an EntityID column.

fun <ID : Any> entityId(name: String, table: IdTable<ID>): Column<EntityID<ID>>

Creates an EntityID column, with the specified name, for storing the identifier of the specified table.

fun <ID : Any> entityId(name: String, originalColumn: Column<ID>): Column<EntityID<ID>>

Creates an EntityID column, with the specified name, for storing the same objects as the specified originalColumn.

enumeration
Link copied to clipboard
inline fun <T : Enum<T>> enumeration(name: String): Column<T>

Creates an enumeration column, with the specified name, for storing enums of type T by their ordinal.

fun <T : Enum<T>> enumeration(name: String, klass: KClass<T>): Column<T>

Creates an enumeration column, with the specified name, for storing enums of type klass by their ordinal.

enumerationByName
Link copied to clipboard
inline fun <T : Enum<T>> enumerationByName(name: String, length: Int): Column<T>

Creates an enumeration column, with the specified name, for storing enums of type T by their name. With the specified maximum length for each name value.

fun <T : Enum<T>> enumerationByName(name: String, length: Int, klass: KClass<T>): Column<T>

Creates an enumeration column, with the specified name, for storing enums of type klass by their name. With the specified maximum length for each name value.

equals
Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
exists
Link copied to clipboard
fun Table.exists(): Boolean

Returns whether this table exists in the database.

float
Link copied to clipboard
fun float(name: String): Column<Float>

Creates a numeric column, with the specified name, for storing 4-byte (single precision) floating-point numbers.

foreignKey
Link copied to clipboard
fun foreignKey(vararg references: Pair<Column<*>, Column<*>>, onUpdate: ReferenceOption? = null, onDelete: ReferenceOption? = null, name: String? = null)
fun foreignKey(vararg from: Column<*>, target: Table.PrimaryKey, onUpdate: ReferenceOption? = null, onDelete: ReferenceOption? = null, name: String? = null)

Creates a composite foreign key.

fullJoin
Link copied to clipboard
open infix override fun fullJoin(otherTable: ColumnSet): Join

Creates a full outer join relation with otherTable.

hashCode
Link copied to clipboard
open override fun hashCode(): Int
index
Link copied to clipboard
fun index(isUnique: Boolean = false, vararg columns: Column<*>)
fun index(customIndexName: String? = null, isUnique: Boolean = false, vararg columns: Column<*>, functions: List<ExpressionWithColumnType<*>>? = null, indexType: String? = null, filterCondition: FilterCondition = null)

Creates an index.

fun <T> Column<T>.index(customIndexName: String? = null, isUnique: Boolean = false): Column<T>

Creates an index composed by this column only.

innerJoin
Link copied to clipboard
open infix override fun innerJoin(otherTable: ColumnSet): Join

Creates an inner join relation with otherTable.

integer
Link copied to clipboard
fun integer(name: String): Column<Int>

Creates a numeric column, with the specified name, for storing 4-byte integers.

join
Link copied to clipboard
open override fun join(otherTable: ColumnSet, joinType: JoinType, onColumn: Expression<*>?, otherColumn: Expression<*>?, lateral: Boolean, additionalConstraint: SqlExpressionBuilder.() -> Op<Boolean>?): Join

Creates a join relation with otherTable. When all joining options are absent Exposed will try to resolve referencing columns by itself.

joinQuery
Link copied to clipboard
fun Table.joinQuery(on: SqlExpressionBuilder.(QueryAlias) -> Op<Boolean>? = null, joinType: JoinType = JoinType.INNER, lateral: Boolean = false, joinPart: () -> AbstractQuery<*>): Join

Creates a join relation between this table and a query.

largeText
Link copied to clipboard
fun largeText(name: String, collate: String? = null, eagerLoading: Boolean = false): Column<String>

Creates a character column, with the specified name, for storing strings of large length using the specified collate type. If no collated type is specified, then the database default is used.

leftJoin
Link copied to clipboard
open infix override fun leftJoin(otherTable: ColumnSet): Join

Creates a left outer join relation with otherTable.

long
Link copied to clipboard
fun long(name: String): Column<Long>

Creates a numeric column, with the specified name, for storing 8-byte integers.

mediumText
Link copied to clipboard
fun mediumText(name: String, collate: String? = null, eagerLoading: Boolean = false): Column<String>

Creates a character column, with the specified name, for storing strings of medium length using the specified collate type. If no collated type is specified, then the database default is used.

modifyStatement
Link copied to clipboard
open override fun modifyStatement(): List<String>

Returns the list of DDL statements that modify this object.

nameInDatabaseCase
Link copied to clipboard
fun nameInDatabaseCase(): String

Returns the table name in proper case. Should be called within transaction or default tableName will be returned.

nameInDatabaseCaseUnquoted
Link copied to clipboard
fun nameInDatabaseCaseUnquoted(): String

Returns the table name, without schema and in proper case, with wrapping single- and double-quotation characters removed.

nullable
Link copied to clipboard
fun <T : Any, C : CompositeColumn<T>> C.nullable(): CompositeColumn<T?>

Marks this CompositeColumn as nullable.

fun <T : Any> Column<T>.nullable(): Column<T?>

Marks this column as nullable.

nullTransform
Link copied to clipboard
@JvmName(name = "nullTransform")
fun <Unwrapped : Any, Wrapped : Any> Column<Unwrapped>.nullTransform(transformer: ColumnTransformer<Unwrapped, Wrapped?>): Column<Wrapped?>
@JvmName(name = "nullTransform")
fun <Unwrapped : Any, Wrapped : Any> Column<Unwrapped>.nullTransform(wrap: (Unwrapped) -> Wrapped?, unwrap: (Wrapped?) -> Unwrapped): Column<Wrapped?>

Applies a special transformation that allows a non-nullable database column to accept and/or return values as `null` on the client side.

optReference
Link copied to clipboard
fun <T : Any> optReference(name: String, foreign: IdTable<T>, onDelete: ReferenceOption? = null, onUpdate: ReferenceOption? = null, fkName: String? = null): Column<EntityID<T>?>

Creates a column with the specified name with an optional reference to the `id` column in foreign table with onDelete, onUpdate, and fkName options. onDelete and onUpdate options describe the behavior for how links between tables will be checked when deleting or changing corresponding columns' values. Such a relationship will be represented as a FOREIGN KEY constraint on table creation.

fun <T : Any> optReference(name: String, refColumn: Column<T>, onDelete: ReferenceOption? = null, onUpdate: ReferenceOption? = null, fkName: String? = null): Column<T?>
@JvmName(name = "optReferenceByIdColumn")
fun <T : Any, E : EntityID<T>> optReference(name: String, refColumn: Column<E>, onDelete: ReferenceOption? = null, onUpdate: ReferenceOption? = null, fkName: String? = null): Column<E?>

Creates a column with the specified name with an optional reference to the refColumn column with onDelete, onUpdate, and fkName options. onDelete and onUpdate options describe the behavior for how links between tables will be checked when deleting or changing corresponding columns' values. Such a relationship will be represented as a FOREIGN KEY constraint on table creation.

reference
Link copied to clipboard
fun <T : Any> reference(name: String, foreign: IdTable<T>, onDelete: ReferenceOption? = null, onUpdate: ReferenceOption? = null, fkName: String? = null): Column<EntityID<T>>

Creates a column with the specified name with a reference to the `id` column in foreign table and with onDelete, onUpdate, and fkName options. onDelete and onUpdate options describe the behavior for how links between tables will be checked when deleting or changing corresponding columns' values. Such a relationship will be represented as a FOREIGN KEY constraint on table creation.

fun <T : Any> reference(name: String, refColumn: Column<T>, onDelete: ReferenceOption? = null, onUpdate: ReferenceOption? = null, fkName: String? = null): Column<T>
@JvmName(name = "referenceByIdColumn")
fun <T : Any, E : EntityID<T>> reference(name: String, refColumn: Column<E>, onDelete: ReferenceOption? = null, onUpdate: ReferenceOption? = null, fkName: String? = null): Column<E>

Creates a column with the specified name with a reference to the refColumn column and with onDelete, onUpdate, and fkName options. onDelete and onUpdate options describe the behavior for how links between tables will be checked when deleting or changing corresponding columns' values. Such a relationship will be represented as a FOREIGN KEY constraint on table creation.

references
Link copied to clipboard
infix fun <T : Any, S : T, C : Column<S>> C.references(ref: Column<T>): C

Creates a reference from this @receiver column to a ref column.

fun <T : Any, S : T, C : Column<S>> C.references(ref: Column<T>, onDelete: ReferenceOption? = null, onUpdate: ReferenceOption? = null, fkName: String? = null): C
@JvmName(name = "referencesById")
fun <T : Any, S : T, C : Column<S>> C.references(ref: Column<EntityID<T>>, onDelete: ReferenceOption? = null, onUpdate: ReferenceOption? = null, fkName: String? = null): C

Creates a reference from this @receiver column to a ref column with onDelete, onUpdate, and fkName options. onDelete and onUpdate options describe the behavior for how links between tables will be checked when deleting or changing corresponding columns' values. Such a relationship will be represented as a FOREIGN KEY constraint on table creation.

registerColumn
Link copied to clipboard
fun <T> registerColumn(name: String, type: IColumnType<T & Any>): Column<T>

Adds a column of the specified type and with the specified name to the table.

registerCompositeColumn
Link copied to clipboard
fun <R, T : CompositeColumn<R>> registerCompositeColumn(column: T): T

Adds all wrapped column components of a CompositeColumn to the table.

replaceColumn
Link copied to clipboard
fun <TColumn : Column<*>> replaceColumn(oldColumn: Column<*>, newColumn: TColumn): TColumn

Replaces the specified oldColumn with the specified newColumn in the table. Mostly used internally by the library.

rightJoin
Link copied to clipboard
open infix override fun rightJoin(otherTable: ColumnSet): Join

Creates a right outer join relation with otherTable.

select
Link copied to clipboard
fun select(columns: List<Expression<*>>): Query

Creates a `SELECT` Query using a list of columns or expressions from this ColumnSet.

fun select(column: Expression<*>, vararg columns: Expression<*>): Query

Creates a `SELECT` Query by selecting either a single column, or a subset of columns, from this ColumnSet.

select
Link copied to clipboard
inline fun FieldSet.select(where: SqlExpressionBuilder.() -> Op<Boolean>): Query
fun FieldSet.select(where: Op<Boolean>): Query
selectAll
Link copied to clipboard
fun FieldSet.selectAll(): Query

Creates a `SELECT` Query by selecting all columns from this ColumnSet.

selectAllBatched
Link copied to clipboard
fun FieldSet.selectAllBatched(batchSize: Int = 1000): Iterable<Iterable<ResultRow>>
selectBatched
Link copied to clipboard
fun FieldSet.selectBatched(batchSize: Int = 1000, where: SqlExpressionBuilder.() -> Op<Boolean>): Iterable<Iterable<ResultRow>>
short
Link copied to clipboard
fun short(name: String): Column<Short>

Creates a numeric column, with the specified name, for storing 2-byte integers.

slice
Link copied to clipboard
fun slice(columns: List<Expression<*>>): FieldSet
fun slice(column: Expression<*>, vararg columns: Expression<*>): FieldSet
targetTables
Link copied to clipboard
fun ColumnSet.targetTables(): List<Table>

Returns the list of tables to which the columns in this column set belong.

text
Link copied to clipboard
fun text(name: String, collate: String? = null, eagerLoading: Boolean = false): Column<String>

Creates a character column, with the specified name, for storing strings of arbitrary length using the specified collate type. If no collated type is specified, then the database default is used.

transform
Link copied to clipboard
@JvmName(name = "transformNullable")
fun <Unwrapped : Any, Wrapped : Any> Column<Unwrapped?>.transform(transformer: ColumnTransformer<Unwrapped?, Wrapped?>): Column<Wrapped?>

Transforms a nullable column by specifying a transformer.

fun <Unwrapped : Any, Wrapped : Any> Column<Unwrapped>.transform(transformer: ColumnTransformer<Unwrapped, Wrapped>): Column<Wrapped>

Transforms a column by specifying a transformer.

@JvmName(name = "transformNullable")
fun <Unwrapped : Any, Wrapped : Any> Column<Unwrapped?>.transform(wrap: (Unwrapped?) -> Wrapped?, unwrap: (Wrapped?) -> Unwrapped?): Column<Wrapped?>

Transforms a nullable column by specifying transformation functions.

fun <Unwrapped : Any, Wrapped : Any> Column<Unwrapped>.transform(wrap: (Unwrapped) -> Wrapped, unwrap: (Wrapped) -> Unwrapped): Column<Wrapped>

Transforms a column by specifying transformation functions.

ubyte
Link copied to clipboard
fun ubyte(name: String): Column<UByte>

Creates a numeric column, with the specified name, for storing 1-byte unsigned integers.

uinteger
Link copied to clipboard
fun uinteger(name: String): Column<UInt>

Creates a numeric column, with the specified name, for storing 4-byte unsigned integers.

ulong
Link copied to clipboard
fun ulong(name: String): Column<ULong>

Creates a numeric column, with the specified name, for storing 8-byte unsigned integers.

uniqueIndex
Link copied to clipboard
fun <T> Column<T>.uniqueIndex(customIndexName: String? = null): Column<T>

Creates a unique index composed by this column only.

fun uniqueIndex(vararg columns: Column<*>, filterCondition: FilterCondition = null)
fun uniqueIndex(customIndexName: String? = null, vararg columns: Column<*>, functions: List<ExpressionWithColumnType<*>>? = null, filterCondition: FilterCondition = null)

Creates a unique index.

ushort
Link copied to clipboard
fun ushort(name: String): Column<UShort>

Creates a numeric column, with the specified name, for storing 2-byte unsigned integers.

uuid
Link copied to clipboard
fun uuid(name: String): Column<UUID>

Creates a binary column, with the specified name, for storing UUIDs.

varchar
Link copied to clipboard
fun varchar(name: String, length: Int, collate: String? = null): Column<String>

Creates a character column, with the specified name, for storing strings with the specified maximum length using the specified text collate type. If no collate type is specified then the database default is used.

withDefinition
Link copied to clipboard
fun <T> Column<T>.withDefinition(vararg definition: Any): Column<T>

Appends a database-specific column definition to this column's SQL in a CREATE TABLE statement.