informix
Informix Guide to SQL: Syntax
Segments

INTERVAL Field Qualifier

The INTERVAL field qualifier specifies the units for an INTERVAL value. Use the INTERVAL Field Qualifier segment whenever you see a reference to an INTERVAL field qualifier in a syntax diagram.

Syntax

Element Purpose Restrictions Syntax
f-precision Maximum number of digits used in the fraction field The default value of f-precision
is 3.
The maximum value that you can specify in f-precision is 5. Literal Number, p. 4-237
precision Number of digits in the largest number of months, days, hours, or minutes that the interval can hold The default value of precision
is 2.
The maximum value that you can specify in precision is 9. Literal Number, p. 4-237
y-precision Number of digits in the largest number of years that the interval can hold The default value of y-precision
is 4.
The maximum value that you can specify in y-precision is 9. Literal Number, p. 4-237

Usage

The next two examples show INTERVAL data types of the YEAR TO MONTH type. The first example can hold an interval of up to 999 years and 11 months, because it gives 3 as the precision of the year field. The second example uses the default precision on the year field, so it can hold an interval of up to 9,999 years and 11 months.

When you want a value to contain only one field, the first and last qualifiers are the same. For example, an interval of whole years is qualified as YEAR TO YEAR or YEAR (5) TO YEAR, for an interval of up to 99,999 years.

The following examples show several forms of INTERVAL qualifiers:

Related Information

For information about how to specify INTERVAL field qualifiers and use INTERVAL data in arithmetic and relational operations, see the discussion of the INTERVAL data type in the Informix Guide to SQL: Reference.


Informix Guide to SQL: Syntax, Version 9.2
Copyright © 1999, Informix Software, Inc. All rights reserved