Operators
Operators are basic syntax elements that appear in expressions.
In this documentation, there are different sort of syntax elements that are considered as
operators, such as classical comparison operators (a==b
), arithmetic operators
(a+b
), string manipulation operators (s1||s2
) as well as
predefined variables like SQLSTATE
, and utility operators like
SFMT()
or TODAY
.
Elements of an expression are evaluated by following precedence rules, from highest to lowest.
Use ()
parentheses to instruct the runtime system to evaluate the expression in a
different way than the default order of precedence.
We distinguish different kind of operators:
- Basic operators such as
+
,||
,AND
,ASCII
, which take a left operand, a right operand, or both left and right operands. When used together in the same expression, basic operators follow the order of precedence list. - Assignment operators such as
+=
,||=
, are part of the syntax of theLET
statement, and can only be used withing this statement. Consequently, assignment operators are not concerned by precedence order rules. - Function operators like
TODAY
,IIF()
,SFMT()
, where some take parameters enclosed in parentheses. Function operators act like functions by returning a value. Function operators have the lowest order of precedence when used with basic operators. Function operators can be identified with the [function] marker in the title of their reference topic. - Variable operators like
SQLSTATE
, with the same predecence rules than function operators. Variable operators can be identified with the [variable] marker in the title of their reference topic.