Operators for Binary Expressions
Various logical, mathematical and string operators are provided to created queries using binary expressions.
Operator | Description and Examples | Datatypes | Result type |
---|---|---|---|
Relational Expression Operators | |||
= | equality
x = y |
x and y can be any type | Boolean |
!=
<> |
inequality
x != y x <> y |
x and y can be any type. | Boolean |
>
< >= <= |
Greater than
Less than Greater than or equal to Less than or equal to x > y (and so on) Generically known as comparison operators |
x and y must both be number types, or both be Datetime types. | Boolean |
Logical Operators | |||
and or | Logical (Boolean) and, or.
x and y x or y |
x and y must be Boolean | Boolean |
Mathematical Operators
Also used in the projection (select clause) |
|||
* | Multiplication
x * y |
x and y must both be numbers. | Either the type of x or y, whichever has the larger capacity. |
\ | Division
x \ y |
x and y must both be numbers. | double |
mod | Remainder
x mod y |
x and y must both be numbers. | Either the type of x or y, whichever has the larger capacity. |
+ | Addition
x + y |
x and y must both be numbers. | Either the type of x or y, whichever has the larger capacity. |
- | Subtraction
x - y |
x and y must both be numbers. | Either the type of x or y, whichever has the larger capacity. |
Postfix Operators | |||
[] | Array dereferencing, to access an array element.
x[y] |
x must be an array and y must be an int. | Type of the array element. |
. | For object graph traversal, to access a property
x.y |
x must be an entity and y must be a property. | Type of y. |
@ | For object graph traversal, to access an attribute
customer@extId |
x must be an entity and y must be a attribute. | Type of y. |
String Operator | |||
|| | String concatenation
x || y |
x and y must be String | String |
like | The like operator matches all strings that match the regular expression provided in double quotes.
With the Coherence cache provider, you can use Java RegEx regular expression syntax. With the TIBCO cache provider, you can use "*.*" syntax, for example: select symbol from /ConceptModel/StockTick where symbol like ".*T.*" Results: TIBX, MSFT, where symbol like ".*T" Results: MSFT where symbol like "TIBX" Results: TIBX where symbol like "TIB." Results: TIBX where symbol like ".*" Results: JNJ, VMW, TIBX, HPQ, MSFT, HPQ |
String | Boolean |