INTERVAL

INTERVAL is a numeric data type that stores periods of time. It stores the difference between two moments in time as the DECIMAL format that includes a contiguous sequence of values representing units of time. The INTERVAL data types can be divided into two types:

The above two types of intervals cannot be inter-converted within the 4GL, they require different INTERVAL qualifiers and numeric interval values that cannot be mixed.

 

INTERVAL data type can be used to store age, sums of ages, periods of some activities, person-hours or person-years of effort, etc. This data type has the structure similar to that of the DATETIME data type. The INTERVAL data type has the following structure when declared:

 

 

INTERVAL Qualifier

Specifies the precision and scale of a INTERVAL value.

 

DEFINE my_interval1 INTERVAL YEAR TO MONTH --year-month INTERVAL

DEFINE my_interval2 INTERVAL DAY TO FRACTION --day-time INTERVAL

 

Unlike DATETIME data types, values of the INTERVAL data type can be equal to zero or they can obtain negative values. E.g. if you subtract a larger interval from a smaller one, you can get a negative value of INTERVAL data type as the result.

 

Contact Us

Privacy Policy

Copyright © 2024 Querix, (UK) Ltd.