Integer expressions
This section covers integer expression evaluation rules.
An integer expression evaluates to a whole number of type INTEGER
(or DECIMAL
)
MAIN
DEFINE r, c INTEGER
LET c = 4
LET r = c * ( 2 + c MOD 4 ) / getRowCount("customers")
END MAIN
The operands of an integer expression can be:
- An integer literal.
- A variable or constant of type
TINYINT
,SMALLINT
,INTEGER
orBIGINT
. - A function returning a single integer value.
- A boolean expression.
- The result of a
DATE
subtraction, as a number of days.
If an integer expression includes an operand whose value is not an integer data type, the runtime system attempts to convert the value to an integer following the data conversion rules.
If an element of an integer expression is NULL
,
the expression is evaluated to NULL
.
The data type of an integer expression is typically INTEGER
. However, if the
expression contains operators that can produce a decimal number like the division operator, the expresion type can be
DECIMAL
.