Interval expressions
This section covers interval expression evaluation rules.
An interval evaluates to an INTERVAL
data type.
MAIN
DEFINE r, c INTERVAL HOUR TO MINUTE
LET c = "12:45"
LET r = c + ( DATETIME(14:02) HOUR TO MINUTE - DATETIME(10:43) HOUR TO MINUTE )
END MAIN
The operands of an interval expression must be one of:
- An interval literal.
- A character string literal representing an
Interval with the format
YYYY-MM-DD hh:mm:ss.fffff
. - An integer expression using the
UNITS
operator. - A variable or constant of
INTERVAL
type. - A function returning a single interval value.
- The result of a
DATETIME
subtraction.
If an interval expression includes an operand whose value is not an interval data type, the runtime system attempts to convert the value to an interval value following the data conversion rules.
If an element of an integer expression is NULL
, the expression is evaluated to NULL
.