SQL/MP Reference Manual
HP NonStop SQL/MP Reference Manual—523352-013
I-20
Considerations—INTERVAL Data Type
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.
Considerations—INTERVAL Data Type
A specific INTERVAL data type is compatible only with another INTERVAL data
type that has the same range of INTERVAL fields.
An INTERVAL value can have a maximum of 18 digits, including the digits in all
fields.
Any INTERVAL field that is a starting field can have up to 18 digits minus the
number of other digits in the INTERVAL value (but the starting field will have only 2
digits unless you specify a larger value with the digits option). The maximum
value for the starting field is the maximum value that can be expressed in the
number of digits allowed for the field.
If an INTERVAL field is not a starting field, the maximum value of digits in the field
is:
YEAR (Always a starting field)
MONTH 1 to 11
DAY (Always a starting field)
HOUR 1 to 23