Rules for ESQL operator precedence

When an expression involves more than one operator, the order in which the expression is evaluated might affect the result. Consider the following example:

SET a = b + c * d;

Under ESQL's precedence rules, c is multiplied by d and the result is added to b. This rule states that multiplication takes precedence over addition, so reordering the expression as follows:

SET a = c * d + b;

makes no difference. ESQL's precedence rules are set out below but it is generally considered good practice to use parentheses to make the meaning clear. The order of precedence is:

  1. Parentheses
  2. Unary operators including unary - and NOT
  3. Multiplication and division
  4. Concatenation
  5. Addition and subtraction

Operations at the same level are evaluated from left to right.

Related concepts
Message flows overview
Message mappings overview
Related tasks
Developing message flows
Developing ESQL
Related reference
Built-in nodes
ESQL reference