The following rules apply to Interval expressions.
- Expressions involving intervals are evaluated by converting the operands to integers, evaluating the resulting arithmetic expression, and then converting the result back to the appropriate interval.
- The data type of both an interval_expression and an interval_primary is INTERVAL.
- An interval_expression must contain either year-month interval components or day-time interval components. Mixing of INTERVAL types is not permitted.
- Expressions involving intervals always evaluate to an interval, even if the expressions contain DateTime or Numeric expressions.
|IF an interval_expression contains …||THEN the result …|
|only one component of type INTERVAL||is of the same INTERVAL type.|
|a single DateTime value or a start TO end phrase||contains the DateTime fields specified for the DateTime or start TO end phrase values.|
|more than one component of type INTERVAL||is of an INTERVAL type including all the DateTime fields of the INTERVAL types of the component fields.|