OceanBase Database supports multiple operators, such as arithmetic operators, bitwise operators, comparison operators, logical operators, date and time operators, concatenation operators, and collation operators.
Overview
The following list shows operators sorted by precedence from high to low. Operators listed in the same row have the same precedence.
COLLATE
!
- (unary minus operator), ~ (unary bitwise NOT operator)
^
*, /, DIV, %, MOD
-, +
<<, >>
&
|
= (comparison), <=>, >=, >, <=, <, <>, !=, IN
BETWEEN,
NOT
AND, &&
XOR
OR, ||
= (assignment), :=
Description
The precedence of an equal sign (
=) depends on whether it is used as a comparison operator or an assignment operator. A comparison operator has the same precedence as<=>,>=,>,<=,<,<>, and!=. An assignment operator has the same precedence as:=.If operators with equal precedence exist in the same expression, the evaluation is performed from left to right. However, assignment is performed from right to left.
The precedence and meaning of the following operators depend on the SQL mode:
By default,
||is a logicalORoperator. IfPIPES_AS_CONCATis enabled,||is the string concatenation, with the precedence between^and unary operators.By default,
!has higher precedence thanNOT. IfHIGH_NOT_PRECEDENCEis enabled,!and NOT have equal precedence.