An error may be reported:
- If the argument of the INTERVAL function does not have a Period data type.
- If the argument has a PERIOD(DATE) data type and the interval qualifier is not YEAR, YEAR TO MONTH, MONTH, or DAY.
- If the argument has a PERIOD(TIME(n) [WITH TIME ZONE]) data type and the interval qualifier is not HOUR, HOUR TO MINUTE, HOUR TO SECOND, MINUTE, MINUTE TO SECOND or SECOND.
- If the result of an INTERVAL expression violates the rules specified for the precision of an interval qualifier, an error is reported. For example, assume p1 is a PERIOD(TIMESTAMP(0)) expression that has a value of PERIOD '(2006-01-01 12:12:12, 2007-01-01 12:12:12)'. If INTERVAL(p1) DAY is specified, the default precision for the DAY interval qualifier is 2, and, since the result is 365 days which is a three-digit value that cannot fit into a DAY(2) interval qualifier, an error is reported.
- If the argument of the INTERVAL function is a period of a DATE or TIMESTAMP(n) [WITH TIME ZONE] and the ending bound value is UNTIL_CHANGED.