Neoview SQL Reference Manual (R2.2)
EXTRACT Function
The EXTRACT function extracts a datetime field from a datetime or interval value expression.
It returns an exact numeric value.
EXTRACT (datetime-field FROM extract-source)
datetime-field is:
YEAR | MONTH | DAY | HOUR | MINUTE | SECOND
extract-source is:
datetime-expression | interval-expression
See “Datetime Value Expressions” (page 210) and “Interval Value Expressions” (page 213).
Examples of EXTRACT
• Extract the year from a DATE value:
EXTRACT (YEAR FROM DATE '1996-09-28')
The result is 1996.
• Extract the year from an INTERVAL value:
EXTRACT (YEAR FROM INTERVAL '01-09' YEAR TO MONTH)
The result is 1.
342 SQL Functions and Expressions