Module org.jooq
Package org.jooq

Interface Variable<T>

All Superinterfaces:
Field<T>, FieldOrConstraint, FieldOrRow, FieldOrRowOrSelect, GroupField, Named, OrderField<T>, ParamOrVariable<T>, QueryPart, SelectField<T>, SelectFieldOrAsterisk, Serializable, TableElement, Typed<T>
All Known Subinterfaces:
Parameter<T>

@Pro public non-sealed interface Variable<T> extends ParamOrVariable<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