SQL/MX 3.2.1 Reference Manual (H06.26+, J06.15+)
SQL/MX Functions and Expressions
HP NonStop SQL/MX Release 3.2.1 Reference Manual—691117-004
8-75
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










