Package org.jooq

Interface DeleteQuery<R extends Record>

  • Type Parameters:
    R - The record type of the table being deleted from
    All Superinterfaces:
    Attachable, java.lang.AutoCloseable, ConditionProvider, Delete<R>, java.util.concurrent.Flow.Publisher<java.lang.Integer>, org.reactivestreams.Publisher<java.lang.Integer>, Query, QueryPart, RowCountQuery, java.io.Serializable, Statement

    public interface DeleteQuery<R extends Record>
    extends ConditionProvider, Delete<R>
    A DELETE statement (model API).

    This type is the model API representation of a Delete statement, which can be mutated after creation. The advantage of this API compared to the DSL API is a more simple approach to writing dynamic SQL.

    Instances can be created using DSLContext.deleteQuery(Table).

    Author:
    Lukas Eder
    • Method Detail

      • addConditions

        @Support
        void addConditions​(Operator operator,
                           java.util.Collection<? extends Condition> conditions)
        Description copied from interface: ConditionProvider
        Adds new conditions to the query, connecting them to existing conditions with the provided operator.
        Specified by:
        addConditions in interface ConditionProvider
        conditions - The condition
      • addOrderBy

        @Support
        void addOrderBy​(OrderField<?>... fields)
        Adds ordering fields.
        Parameters:
        fields - The ordering fields
      • addOrderBy

        @Support
        void addOrderBy​(java.util.Collection<? extends OrderField<?>> fields)
        Adds ordering fields.
        Parameters:
        fields - The ordering fields
      • addLimit

        @Support
        void addLimit​(java.lang.Number numberOfRows)
        Limit the results of this select.
        Parameters:
        numberOfRows - The number of rows to return
      • addLimit

        @Support
        void addLimit​(Param<? extends java.lang.Number> numberOfRows)
        Limit the results of this select using named parameters.
        Parameters:
        numberOfRows - The number of rows to return
      • getReturnedRecord

        @Support({AURORA_POSTGRES,DB2,FIREBIRD,ORACLE,POSTGRES})
        R getReturnedRecord()
        The record holding returned values as specified by any of the setReturning() methods.

        If the DELETE statement returns several records, this is the same as calling getReturnedRecords().get(0)

        This implemented differently for every dialect:

        • Firebird and Postgres have native support for DELETE .. RETURNING clauses
        Returns:
        The returned value as specified by any of the setReturning() methods. This may return null in case jOOQ could not retrieve any generated keys from the JDBC driver.
        See Also:
        getReturnedRecords()
      • getReturnedRecords

        @Support({AURORA_POSTGRES,DB2,FIREBIRD,ORACLE,POSTGRES})
        Result<R> getReturnedRecords()
        The records holding returned values as specified by any of the setReturning() methods.

        If the DELETE statement returns several records, this is the same as calling getReturnedRecords().get(0)

        This implemented differently for every dialect:

        • Firebird and Postgres have native support for DELETE .. RETURNING clauses
        Returns:
        The returned values as specified by any of the setReturning() methods. Note:
        • Not all databases / JDBC drivers support returning several values on multi-row inserts!
        • This may return an empty Result in case jOOQ could not retrieve any generated keys from the JDBC driver.