selectValue

suspend fun <T> selectValue(expression: Expression<T>): T

Executes a SELECT of expression without a FROM clause and returns its single value. This function executes immediately in the current transaction. Some queries without a FROM clause are valid, such as selectValue(intLiteral(1)). Others are not. For example, selectValue(MyTable.id) is rejected by the database during execution because MyTable is not a query source.

For example:

val result: Int = selectValue(intLiteral(1))

suspend fun <T : Any> selectValue(value: T): T

Executes a SELECT of value as an SQL literal without a FROM clause and returns its single value.

Some queries without a FROM clause are valid, such as selectValue(1). Others are not. The database rejects the query during execution if the literal is not supported.

For example:

val result: Int = selectValue(1)

Throws

If value is not supported by literal.