SQL/MX 2.x Reference Manual (H06.04+)

SQL/MX Language Elements
HP NonStop SQL/MX Reference Manual540440-003
6-68
Interval Literals
YEAR | MONTH | DAY | HOUR | MINUTE | SECOND [(fractional-
precision)]
specifies the end-field. If the end-field is SECOND, it can have a
fractional-precision up to 6 digits. The fractional-precision is
the number of digits of precision after the decimal point. The default for
fractional-precision is 6.
start-field | SECOND [(leading-precision,
fractional-precision)]
specifies the single-field. If the single-field is SECOND, the leading-
precision is the number of digits of precision before the decimal point, and the
fractional-precision is the number of digits of precision after the decimal
point.
The default for leading-precision is 2, and the default for fractional-
precision is 6. The maximum for leading-precision is 18, and the
maximum for fractional-precision is 6.
See Interval Data Types on page 6-28 and Interval Value Expressions on page 6-43.
'year-month' | 'day:time'
specifies the date and time components of an interval literal. The day and hour
fields can be separated by a space or a colon. The interval literal strings are:
years Unsigned integer that specifies a number of years. years can be up to
18 digits, or 16 digits if months is the end-field. The maximum for the
leading-precision is specified within the interval qualifier by either
YEAR(18) or YEAR(16) TO MONTH.
months Unsigned integer that specifies a number of months. Used as a starting
field, months can have up to 18 digits. The maximum for the leading-
precision is specified by MONTH(18). Used as an ending field, the
value of months must be in the range 0 to 11.
days Unsigned integer that specifies number of days. days can have up to 18
digits if there is no end-field; 16 digits if hours is the end-field; 14 digits if
minutes is the end-field; and 13-f digits if seconds is the end-field,
where f is the fraction less than or equal to 6. These maximums are
specified by DAY(18), DAY(16) TO HOUR, DAY(14) TO MINUTE, and
DAY(13-f) TO SECOND(f).
hours Unsigned integer that specifies a number of hours. Used as a starting
field, hours can have up to 18 digits if there is no end-field; 16 digits if
minutes is the end-field; and 14-f digits if seconds is the end-field,
where f is the fraction less than or equal to 6. These maximums are
specified by HOUR(18), HOUR(16) TO MINUTE, and HOUR(14-f) TO
SECOND(f). Used as an ending field, the value of hours must be in the
range 0 to 23.