EXTRACT SQL Function
Syntax
EXTRACT(date_time_field FROM date_time_expression)
date_time_field ::
| SECOND
| MINUTE
| HOUR
| DAY
| MONTH
| YEAR
Description
The scalar function EXTRACT returns the a date and time field from a date and time expression.
Example
SELECT SYSDATE() ,EXTRACT(MONTH FROM SYSDATE()) 'month'
FROM admin.syacalctable;
SYSDATE MONTH
---------- -------
11/21/2004 11
Details
The date_time_expression can evaluate to a TIME, DATE or TIMESTAMP data type.
The date_time_field and date_time_expression must be compatible.
date_time_expression is a TIME, DATE or TIMESTAMP from which EXTRACT returns the specified date_time_field.
date_time_field keywords that specify the field to be extracted from the date_time_expression.
Note: SQL-99 and ODBC compatible