SQL/MX 2.x Reference Manual (G06.24+, H06.03+)

SQL/MX Language Elements
HP NonStop SQL/MX Reference Manual523725-004
6-71
Interval Literals
Considerations for Interval Literals
Length of Year-Month and Day-Time Strings
An interval literal can contain a maximum of 18 digits, in the string following the
INTERVAL keyword, plus a hyphen (-) that separates the year-month fields, and colons
(:) that separate the day-time fields. You can also separate day and hour with a space.
SQL/MP Considerations for Interval Literals
SQL/MP Interval Literals With Negative Durations
NonStop SQL/MX allows you to specify a negative interval by placing the sign before
the entire literal, such as -INTERVAL '5' DAY, or immediately before the duration
enclosed in quotes, such as INTERVAL -'5' DAY.
NonStop SQL/MX does not allow your application or SQL/MP stored text (in views,
constraints, column defaults, or partitioning keys) to contain other notations of negative
intervals, such as INTERVAL
'-5' DAY.
Inserting Into or Updating Any SQL/MP INTERVAL Column
NonStop SQL/MX supports inserting into or updating any columns with the INTERVAL
data type in SQL/MP tables—except those consisting of FRACTION only. Use the
usual SQL/MX INTERVAL literal to insert into or update an INTERVAL column in an
SQL/MP table.
minutes Unsigned integer that specifies a number of minutes. Used as a starting
field, minutes can have up to 18 digits if there is no end-field; and 16-f
digits if seconds is the end-field, where f is the fraction less than or
equal to 6. These maximums are specified by MINUTE(18), and
MINUTE(16-f) TO SECOND(f). Used as an ending field, the value of
minutes must be in the range 0 to 59.
seconds Unsigned integer that specifies a number of seconds. Used as a starting
field, seconds can have up to 18 digits, minus the number of digits f in
the fraction less than or equal to 6. This maximum is specified by
SECOND(18-f, f). The value of seconds must be in the range 0 to
59.9(n), where n is the number of digits specified for seconds precision.
fraction Unsigned integer that specifies a fraction of a second. When seconds is
used as an ending field, fraction is limited to the number of digits
specified by the fractional-precision field following the SECOND
keyword.