INTERVAL

Measures the difference between two points in time. Intervals can be positive or negative. The INTERVAL data type is divided into two major subtypes:

Syntax

INTERVAL [ (p) ] 'interval‑literal' [ interval‑qualifier ]

Parameters

p

Specifies precision of the seconds field, where p is an integer between 0 - 6. For details, see Specifying Interval Precision.

Default: 6

interval‑literal

A character string that expresses an interval, conforms to this format:

[-] { quantity subtype-unit }[...] [ AGO ]

For details, see Interval Literal.

interval‑qualifier

Optionally specifies how to interpret and format an interval literal for output, and, optionally, sets precision. If omitted, the default is DAY TO SECOND(6). For details, see Interval Qualifier.

Limits

Name Low Value High Value Resolution
INTERVAL [(p)] DAY TO SECOND

‑106751991 days

04:00:54.775807

+/‑106751991 days

04:00:54.775807

1 microsecond

INTERVAL [(p)] YEAR TO MONTH

~/ ‑768e15 yrs

~ 768e15 yrs

1 month