Language basics / Literals |
Interval literals define an interval value in an expression.
INTERVAL ( inrep ) YEAR[(precision)] TO MONTH |INTERVAL ( inrep ) YEAR[(precision)] TO YEAR |INTERVAL ( inrep ) MONTH[(precision)] TO MONTH
INTERVAL ( inrep ) DAY[(precision)] TO FRACTION[(scale)] |INTERVAL ( inrep ) DAY[(precision)] TO SECOND |INTERVAL ( inrep ) DAY[(precision)] TO MINUTE |INTERVAL ( inrep ) DAY[(precision)] TO HOUR |INTERVAL ( inrep ) DAY[(precision)] TO DAY |INTERVAL ( inrep ) HOUR[(precision)] TO FRACTION[(scale)] |INTERVAL ( inrep ) HOUR[(precision)] TO SECOND |INTERVAL ( inrep ) HOUR[(precision)] TO MINUTE |INTERVAL ( inrep ) HOUR[(precision)] TO HOUR |INTERVAL ( inrep ) MINUTE[(precision)] TO FRACTION[(scale)] |INTERVAL ( inrep ) MINUTE[(precision)] TO SECOND |INTERVAL ( inrep ) MINUTE[(precision)] TO MINUTE |INTERVAL ( inrep ) SECOND[(precision)] TO FRACTION[(scale)] |INTERVAL ( inrep ) SECOND[(precision)] TO SECOND |INTERVAL ( inrep ) FRACTION TO FRACTION[(scale)]
An interval literal is specified with the INTERVAL() notation, and is typically used to assign in interval or datetime expressions, or to assign an interval variable.
MAIN DEFINE i1 INTERVAL YEAR TO MONTH DEFINE i2 INTERVAL HOUR(5) TO SECOND LET i1 = INTERVAL( 345-5 ) YEAR TO MONTH LET i2 = INTERVAL( 34562:22:33 ) HOUR(5) TO SECOND END MAIN