Neoview SQL Reference Manual (R2.2)

Datetime Value Expressions
“Considerations for Datetime Value Expressions”
“Examples of Datetime Value Expressions”
The operands of a datetime value expression can be combined in specific ways with arithmetic
operators.
In this syntax diagram, the data type of a datetime primary is DATE, TIME, or TIMESTAMP.
The data type of an interval term is INTERVAL.
datetime-expression is:
datetime-primary
| interval-expression + datetime-primary
| datetime-expression + interval-term
| datetime-expression - interval-term
datetime-primary is:
datetime-literal
| column-reference
| datetime-type-host-variable
| dynamic parameter
| datetime-value-function
| aggregate-function
| sequence-function
| scalar-subquery
| CASE-expression
| CAST-expression
| (datetime-expression)
interval-term is:
interval-factor
| numeric-term * interval-factor
interval-factor is:
[+|-] interval-primary
interval-primary is:
interval-literal
| column-reference
| interval-type-host-variable
| dynamic parameter
| aggregate-function
| sequence-function
| scalar-subquery
| CASE-expression
| CAST-expression
| (interval-expression)
When a numeric value is added to or subtracted from a datetime type, the numeric value is
automatically CASTed to an INTERVAL DAY value. When a numeric value is added to or
subtracted from a time type or a timestamp type, the numeric value is automatically CASTed to
an INTERVAL SECOND value. For information on CAST, see “CAST Expression” (page 298).
Datetime value expressions are built from operands that can be:
Interval value expressions
Datetime or interval literals
Dynamic parameters
Column references with datetime or interval values
Dynamic parameters
Datetime or interval value functions
Any aggregate functions, sequence functions, scalar subqueries, CASE expressions, or CAST
expressions that return datetime or interval values
210 SQL Language Elements