NonStop SQL/MP Reference Manual

Table Of Contents
NonStop SQL/MP Reference Manual142115
I-20
INTERVAL Data Type
No INTERVAL unit exists to bridge a year-month interval or a day-time interval because
the varying number of days in a month makes conversion on a duration basis inexact.
start-ym [ (digits) ] [ TO end-ym ]
specifies the range of fields for a year-month set of INTERVAL values, or a subset
of the year-month INTERVAL values, and the number of digits allowed for the
starting field in the set.
start-dt [ (digits) ] [ TO end-dt ]
specifies the range of fields for a day-time set of INTERVAL values, or a subset of
the day-time INTERVAL values, and the number of digits allowed for the starting
field in the set.
digits
is an unsigned integer from 1 to 18 that specifies the number of significant digits for
the first field in the set. For example, YEAR(2) allows up to 99 years; YEAR(4)
allows up to 9999 years.
The default is 2 digits. The maximum number of digits in the starting field depends
on the number and size of the remaining fields in the set; the entire INTERVAL
value can contain no more than 18 digits.
precision
is an unsigned integer in the range 1 through 6 that specifies the number of
significant digits with which to express the fraction of a second. The default is 6.
INTERVAL { start-ym } [ (digits) ] [ TO end-ym ]
{ start-dt } [ TO end-dt ]
start-ym and end-ym are:
{ YEAR }
{ MONTH }
but the start-ym you specify must precede the end-ym you
specify in the list.
start-dt and end-dt are:
{ DAY }
{ HOUR }
{ MINUTE }
{ SECOND }
{ FRACTION [ ( precision ) ] }
but the start-dt you specify must precede the end-dt you
specify in the list, and only end-dt can include the
precision option for FRACTION.