ALL / NOT IN Predicate (Value List)
The ALL / NOT IN quantified predicate compares an expression or list of expressions with a list of specified values. The ALL predicate evaluates to TRUE if all the values in the ValueList relate to the expression or list of expressions as indicated by the comparison operator. Similarly, the NOT IN predicate evaluates to TRUE if the expression or list of expressions does not equal one of the values in the list.
SQL syntax
RowValueConstructor{CompOpALL | NOT IN}ValueList
The syntax for RowValueConstructor:
RowValueConstructorElement| (RowValueConstructorList) |
The syntax for RowValueConstructorList:
RowValueConstructorElement[{,RowValueConstructorElement} ... ]
The syntax for RowValueConstructorElement:
Expression | NULL
The syntax for CompOp:
{= | <> | > | >= | < | <= }
The syntax for one element in the ValueList (no parentheses necessary):
ConstantExpression
The syntax for more than one element in the ValueList:
({ConstantExpression} [,...] )
The syntax for an empty ValueList:
( )
Parameters
| Component | Description |
|---|---|
|
|
Specifies a value to be obtained. The values in |
|
|
Specifies a constant value or an expression that evaluates to a constant value (such as a number, character string, or date). This includes support for bound values ( |
|
|
Is equal to. |
|
|
Is not equal to. |
|
|
Is greater than. |
|
|
Is greater than or equal to. |
|
|
Is less than. |
|
|
Is less than or equal to. |
|
|
The predicate is |
|
|
A list of values that are compared against the The The The |
Description
-
If
Xis the value ofExpression, and(a,b, ..., z)represents the elements inValueList, andOPis a comparison operator, then the following is true:-
X OP ALL (a,b,...,z)is equivalent toX OP a AND X OP b AND...AND X OP z.
-
-
If
Xis the value ofExpressionand(a,b,..., z)are the elements in aValueList, then the following is true:-
X NOT IN (a,b,...,z)is equivalent toNOT (X IN (a,b,...,z)).
-
-
All character data types are compared in accordance with the current value of the
NLS_SORTsession parameter. -
See "Numeric Data Types" for information about how TimesTen compares values of different but compatible types.
-
NOT INorNOT EXISTSwithALLcan be specified in anORexpression. -
INandEXISTSwithALLcan be specified in anORexpression. -
When evaluating an empty
ValueList, the result ofExpressionNOT INis true. -
If
RowValueConstructorListis specified only the operators=and<>are allowed.
Examples
To query an empty select list for a NOT IN condition:
SELECT * FROM t1 WHERE x1 NOT IN ();
For ValueList examples, see the Examples section in "ANY / IN Predicate (Value List)".