- All Superinterfaces:
QueryPart,Serializable
- All Known Subinterfaces:
False,JSONExistsOnStep,LikeEscapeStep,True
- All Known Implementing Classes:
CustomCondition
Conditions can be used in a variety of SQL clauses. They're mainly used in a
Select statement's WHERE clause, but can also appear in
(non-exhaustive list):
SELECT .. WHERE, e.g. viaSelectWhereStep.where(Condition)SELECT .. HAVING, e.g. viaSelectHavingStep.having(Condition)- In a
CASEexpression, e.g. viaDSL.case_()andCase.when(Condition, Field) - As an ordinary column expression, e.g. via
DSL.field(Condition) - In filtered aggregate functions, e.g. via
AggregateFilterStep.filterWhere(Condition) - ... and many more
Example:
// Assuming import static org.jooq.impl.DSL.*;
using(configuration)
.select()
.from(ACTOR)
.where(ACTOR.ACTOR_ID.eq(1)) // The eq operator produces a Condition from two Fields
.fetch();
Instances can be created using DSL.condition(Field) and overloads, or
by calling a comparison operator method on Field, such as
Field.eq(Field).
- Author:
- Lukas Eder
-
Method Summary
Modifier and TypeMethodDescription@NotNull ConditionCombine this condition with another one using theOperator.ANDoperator.@NotNull ConditionCombine this condition with another one using theOperator.ANDoperator.@NotNull ConditionCombine this condition with another one using theOperator.ANDoperator.@NotNull ConditionCombine this condition with another one using theOperator.ANDoperator.@NotNull ConditionCombine this condition with another one using theOperator.ANDoperator.@NotNull ConditionCombine this condition with another one using theOperator.ANDoperator.@NotNull ConditionCombine this condition with an EXISTS clause using theOperator.ANDoperator.@NotNull ConditionCombine this condition with a negated other one using theOperator.ANDoperator.@NotNull ConditionCombine this condition with a negated other one using theOperator.ANDoperator.@NotNull ConditionandNotExists(Select<?> select)Combine this condition with a NOT EXIST clause using theOperator.ANDoperator.@NotNull Conditionnot()Invert this condition@NotNull ConditionCombine this condition with another one using theOperator.ORoperator.@NotNull ConditionCombine this condition with another one using theOperator.ORoperator.@NotNull ConditionCombine this condition with another one using theOperator.ORoperator.@NotNull ConditionCombine this condition with another one using theOperator.ORoperator.@NotNull ConditionCombine this condition with another one using theOperator.ORoperator.@NotNull ConditionCombine this condition with another one using theOperator.ORoperator.@NotNull ConditionCombine this condition with an EXISTS clause using theOperator.ORoperator.@NotNull ConditionCombine this condition with a negated other one using theOperator.ORoperator.@NotNull ConditionCombine this condition with a negated other one using theOperator.ORoperator.@NotNull ConditionorNotExists(Select<?> select)Combine this condition with a NOT EXIST clause using theOperator.ORoperator.
-
Method Details
-
and
Combine this condition with another one using theOperator.ANDoperator.- Parameters:
other- The other condition- Returns:
- The combined condition
-
and
Combine this condition with another one using theOperator.ANDoperator.- Parameters:
other- The other condition- Returns:
- The combined condition
-
and
Combine this condition with another one using theOperator.ANDoperator.NOTE: When inserting plain SQL into jOOQ objects, you must guarantee syntax integrity. You may also create the possibility of malicious SQL injection. Be sure to properly use bind variables and/or escape literals when concatenated into SQL clauses!
- Parameters:
sql- The other condition- Returns:
- The combined condition
- See Also:
DSL.condition(SQL),SQL
-
and
Combine this condition with another one using theOperator.ANDoperator.NOTE: When inserting plain SQL into jOOQ objects, you must guarantee syntax integrity. You may also create the possibility of malicious SQL injection. Be sure to properly use bind variables and/or escape literals when concatenated into SQL clauses!
- Parameters:
sql- The other condition- Returns:
- The combined condition
- See Also:
DSL.condition(String),SQL
-
and
Combine this condition with another one using theOperator.ANDoperator.NOTE: When inserting plain SQL into jOOQ objects, you must guarantee syntax integrity. You may also create the possibility of malicious SQL injection. Be sure to properly use bind variables and/or escape literals when concatenated into SQL clauses!
- Parameters:
sql- The other conditionbindings- The bindings- Returns:
- The combined condition
- See Also:
DSL.condition(String, Object...),DSL.sql(String, Object...),SQL
-
and
Combine this condition with another one using theOperator.ANDoperator.NOTE: When inserting plain SQL into jOOQ objects, you must guarantee syntax integrity. You may also create the possibility of malicious SQL injection. Be sure to properly use bind variables and/or escape literals when concatenated into SQL clauses!
- Parameters:
sql- The SQL clause, containing {numbered placeholders} where query parts can be injectedparts- TheQueryPartobjects that are rendered at the {numbered placeholder} locations- Returns:
- The combined condition
- See Also:
DSL.condition(String, QueryPart...),DSL.sql(String, QueryPart...),SQL
-
andNot
Combine this condition with a negated other one using theOperator.ANDoperator.- Parameters:
other- The other condition- Returns:
- The combined condition
-
andNot
Combine this condition with a negated other one using theOperator.ANDoperator.- Parameters:
other- The other condition- Returns:
- The combined condition
-
andExists
Combine this condition with an EXISTS clause using theOperator.ANDoperator.- Parameters:
select- The EXISTS's subquery- Returns:
- The combined condition
-
andNotExists
Combine this condition with a NOT EXIST clause using theOperator.ANDoperator.- Parameters:
select- The EXISTS's subquery- Returns:
- The combined condition
-
or
Combine this condition with another one using theOperator.ORoperator.- Parameters:
other- The other condition- Returns:
- The combined condition
-
or
Combine this condition with another one using theOperator.ORoperator.- Parameters:
other- The other condition- Returns:
- The combined condition
-
or
Combine this condition with another one using theOperator.ORoperator.NOTE: When inserting plain SQL into jOOQ objects, you must guarantee syntax integrity. You may also create the possibility of malicious SQL injection. Be sure to properly use bind variables and/or escape literals when concatenated into SQL clauses!
- Parameters:
sql- The other condition- Returns:
- The combined condition
- See Also:
DSL.condition(SQL),SQL
-
or
Combine this condition with another one using theOperator.ORoperator.NOTE: When inserting plain SQL into jOOQ objects, you must guarantee syntax integrity. You may also create the possibility of malicious SQL injection. Be sure to properly use bind variables and/or escape literals when concatenated into SQL clauses!
- Parameters:
sql- The other condition- Returns:
- The combined condition
- See Also:
DSL.condition(String),SQL
-
or
Combine this condition with another one using theOperator.ORoperator.NOTE: When inserting plain SQL into jOOQ objects, you must guarantee syntax integrity. You may also create the possibility of malicious SQL injection. Be sure to properly use bind variables and/or escape literals when concatenated into SQL clauses!
- Parameters:
sql- The other conditionbindings- The bindings- Returns:
- The combined condition
- See Also:
DSL.condition(String, Object...),DSL.sql(String, Object...),SQL
-
or
Combine this condition with another one using theOperator.ORoperator.NOTE: When inserting plain SQL into jOOQ objects, you must guarantee syntax integrity. You may also create the possibility of malicious SQL injection. Be sure to properly use bind variables and/or escape literals when concatenated into SQL clauses!
- Parameters:
sql- The SQL clause, containing {numbered placeholders} where query parts can be injectedparts- TheQueryPartobjects that are rendered at the {numbered placeholder} locations- Returns:
- The combined condition
- See Also:
DSL.condition(String, Object...),DSL.sql(String, QueryPart...),SQL
-
orNot
Combine this condition with a negated other one using theOperator.ORoperator.- Parameters:
other- The other condition- Returns:
- The combined condition
-
orNot
Combine this condition with a negated other one using theOperator.ORoperator.- Parameters:
other- The other condition- Returns:
- The combined condition
-
orExists
Combine this condition with an EXISTS clause using theOperator.ORoperator.- Parameters:
select- The EXISTS's subquery- Returns:
- The combined condition
-
orNotExists
Combine this condition with a NOT EXIST clause using theOperator.ORoperator.- Parameters:
select- The EXISTS's subquery- Returns:
- The combined condition
-
not
Invert this conditionThis is the same as calling
DSL.not(Condition)- Returns:
- This condition, inverted
-