Module org.jooq
Package org.jooq

Interface Variable<T>

  • All Superinterfaces:
    Field<T>, FieldOrConstraint, FieldOrRow, GroupField, Named, OrderField<T>, QueryPart, SelectField<T>, SelectFieldOrAsterisk, Serializable

    @Pro
    public interface Variable<T>
    extends Field<T>
    A local variable reference.

    In procedural languages, local variables are essential to make values reusable to a program or block.

    Example:

     // Assuming import static org.jooq.impl.DSL.*;
    
     Variable<Integer> i = var("i", SQLDataType.INTEGER);
     using(configuration)
        .begin(
            declare(i).set(1),
            insertInto(TABLE).columns(TABLE.COL1).values(i),
            i.set(i.plus(1)),
            insertInto(TABLE).columns(TABLE.COL1).values(i)
        )
        .execute();
     

    Instances can be created using DSL.var(Name, DataType) and overloads.

    Author:
    Lukas Eder