EXTRACT extracts and returns the value of a specified datetime field from a datetime or interval value expression.
The field you are extracting must be a field of the datetime_value_expr
or interval_value_expr
. For example, you can extract only YEAR
, MONTH
, and DAY
from a DATE
value. Likewise, you can extract TIMEZONE_HOUR
and TIMEZONE_MINUTE
only from the TIMESTAMP
WITH
TIME
ZONE
datatype.
eg.
YEAR
FROM SYSDATE) FROM DUAL; return Current Year MONTH
FROM SYSDATE) FROM DUAL; return Current Month DAY
FROM SYSDATE) FROM DUAL; return Current Day HOUR
FROM SYSDATE) FROM DUAL;Error HOUR
FROM TIMESTAMP '2005-10-10 10:10:10') FROM DUAL;
MINUTE
FROM SYSDATE) FROM DUAL;Error MINUTE
FROM TIMESTAMP '2005-10-10 10:10:10') FROM DUAL;