Expressions.expr-primary-interval

An interval value

Format

INTERVAL { 'Interval' | ? | ( IntervalExpr ) } { YEAR | MONTH | DAY | HOUR | MINUTE | SECOND }

[ TO { MONTH | DAY | HOUR | MINUTE | SECOND } ]

Remarks

Interval values are defined using the INTERVAL keyword followed by an Interval value, followed by the start scale of the interval.

The Interval value can be one of the following:

This can optionally be followed by an end scale using the TO keyword. If the end scale is omitted, the end scale is assumed to be the same as the starting scale.

There are some restrictions when both start and end scale are specified:

  1. The start scale must be greater or equal to the end scale. For example HOUR TO DAY would result in an error.
  2. If the start scale is YEAR, the end scale can only MONTH.
  3. If the start scale is MONTH, no end scale is allowed.

Intervals can be negative.

 

INTERVAL '5' MINUTE

INTERVAL '5 12' DAY TO HOUR

INTERVAL '-1 12:10' DAY TO MINUTE

INTERVAL ? SECOND

INTERVAL ('5:' || ?) MINUTE TO SECOND


Disclaimer

Geo SCADA Expert 2019