Interface CallFunction<T>

Type Parameters:
T - The function's return type.
All Superinterfaces:
Attachable, AttachableQueryPart, Fields, Flow.Publisher<Record1<T>>, Iterable<Record1<T>>, Publisher<Record1<T>>, org.reactivestreams.Publisher<Record1<T>>, Query, QueryPart, ResultQuery<Record1<T>>, Serializable, Statement
All Known Subinterfaces:
QOM.CallFunction<T>

@Pro public interface CallFunction<T> extends ResultQuery<Record1<T>>
A call to a stored scalar function, created from CallReturnsStep.returns(DataType).

The call can be used in different ways:

  • As a ResultQuery: The function call is executed in a SELECT statement, e.g. SELECT f(?, ?).
  • As a Field: asField() produces the plain function call f(?, ?), which can be used in other queries wherever a Field can be used.

Example:

// Executing the function call
Integer i = ctx.fetchValue(call(name("f")).args(val(1)).returns(INTEGER));

// Embedding the function call in another query
Field<Integer> f = call(name("f")).args(BOOK.ID).returns(INTEGER).asField();
Result<Record2<Integer, Integer>> result =
ctx.select(BOOK.ID, f)
   .from(BOOK)
   .fetch();
Author:
Lukas Eder
  • Method Details

    • asField

      @NotNull @NotNull Field<T> asField()
      The function call as a Field, to be embedded in other queries.
    • asField

      @NotNull @NotNull Field<T> asField(String alias)
      The function call as an aliased Field, to be embedded in other queries.