SQL/MX 3.x Reference Manual (H06.22+, J06.11+)
SQL/MX Functions and Expressions
HP NonStop SQL/MX Reference Manual—640322-001
9-63
EXTRACT Function
EXTRACT Function
The EXTRACT function extracts a datetime field from a datetime or interval value
expression. It returns an exact numeric value.
See Datetime Value Expressions on page 6-43 and Interval Value Expressions on
page 6-47.
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.
EXTRACT (datetime-field FROM extract-source)
datetime-field is:
YEAR | MONTH | DAY | HOUR | MINUTE | SECOND
extract-source is:
datetime-expression | interval-expression










