INTERVAL
This data type stores spans of time, the differences between two points in
time. You can also use it to store quantities that are naturally measured in units
of time, such as age or sums of ages, estimated or actual time required for
some activity, or person-hours or person-years of effort attributed to some task.
An INTERVAL data value is stored as a DECIMAL number that includes a
contiguous sequence of values representing units of time.
The INTERVAL data types of 4GL fall into two classes, based on their
precision:
A year-month interval can represent a span of years and/or months
A day-time interval can represent a span of days, hours, minutes, seconds, and
fractions of a second, or a contiguous subset of those time units.
Unlike DATETIME data types, which they somewhat resemble in their format,
INTERVAL data types can assume zero or negative values. The declaration of an
INTERVAL data type uses the following syntax:
INTERVAL Qualifiers
The INTERVAL qualifier specifies the precision and scale of an INTERVAL data
type, using a first TO last format to declare 4GL variables, named constants,
function and report parameters, and screen fields. It has the same syntax in
declarations of 4GL variables, named constants, and FORMONLY fields as for INTERVAL
columns of the database.
INTERVAL Literals and Delimiters
The INTERVAL literal format begins with the INTERVAL keyword, followed by a
pair of parentheses that enclose unsigned whole numbers (separated by delimiters)
to represent a consecutive sequence of year through fraction values, or as a
portion thereof. This must be followed by a valid INTERVAL qualifier, specifying
the first TO last keywords for the set of time units: