Criteria
Criteria may be:
- Predicates that evaluate to
TRUE
orFALSE
; - Logical criteria that combine criteria (
AND
,OR
,NOT
); - A value expression with type boolean.
Usage:
- SQL
criteria AND|OR criteria
- SQL
NOT criteria
- SQL
(criteria)
- SQL
expression (=|<>|!=|<|>|<=|>=) (expression|((ANY|ALL|SOME) subquery))
- SQL
expression [NOT] IS NULL
- SQL
expression [NOT] IN (expression[,expression]*)|subquery
- SQL
expression [NOT] LIKE pattern [ESCAPE char]
Matches the string expression against the given string pattern. The pattern may contain
%
to match any number of characters and_
to match any single character. The escape character can be used to escape the match characters%
and_
. - SQL
expression [NOT] SIMILAR TO pattern [ESCAPE char]
SIMILAR TO
is a cross betweenLIKE
and standard regular expression syntax.%
and_
are still used, rather than.*
and.
, respectively.The Data Virtuality Server does not exhaustively validate
SIMILAR TO
pattern values; rather, the pattern is converted to an equivalent regular expression. We recommend not to rely on general regular expression features when usingSIMILAR TO
. If additional features are needed, useLIKE_REGEX
. We do not recommend using a non-literal pattern, as pushdown support is limited. - SQL
expression [NOT] LIKE_REGEX pattern
LIKE_REGEX
allows for standard regular expression syntax to be used for matching. This is different fromSIMILAR TO
andLIKE
in that the escape character is no longer used (\
is already the standard escape mechanism in regular expressions, and%
and_
have no special meaning. The runtime engine uses the JRE implementation of regular expressions; see the java.util.regex.Pattern class for details.The Data Virtuality Server does not exhaustively validate
LIKE_REGEX
pattern values. It is possible to use JRE only for regular expression features not specified by the SQL specification. Additionally, not all sources support the same regular expression flavour or extensions. In pushdown situations, we recommend ensuring that the pattern used will have the same meaning in the Data Virtuality Server and across all applicable sources. - SQL
EXISTS(subquery)
- SQL
expression [NOT] BETWEEN minExpression AND maxExpression
The Data Virtuality Server converts
BETWEEN
into the equivalent formexpression >= minExpression AND expression <= maxExpression
. - SQL
expression
In this case,
expression
has typeboolean
and the following syntax rules apply:- The precedence ordering from lowest to highest is a comparison,
NOT
,AND
,OR
; - Criteria nested in parentheses will be logically evaluated before evaluating the parent criteria. Some examples of valid criteria are:
(balance > 2500.0)
100*(50 - x)/(25 - y) > z
concat(areaCode,concat('-',phone)) LIKE '314%1'
;
- Null values represent an unknown value. Comparison with a null value will evaluate to 'unknown', which can never be
TRUE
even ifnot
is used.
- The precedence ordering from lowest to highest is a comparison,