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 evaluate to an interval, even if the expressions contain DateTime or Numeric expressions.
| What interval_expression Contains | Result |
|---|---|
| Single component of type INTERVAL | Has same INTERVAL type. |
| Single DateTime value or start TO end phrase | Contains DateTime fields specified for DateTime or start TO end phrase values. |
| Multiple components of type INTERVAL | Has INTERVAL type including all DateTime fields of INTERVAL types of component fields. |