EXTRACT extracts and returns the value of a specified datetime field from a datetime or interval value expression.
To extract YEAR from SYSDATE or SYSTIMESTAMP or Date/Timestamp column.
SELECT EXTRACT(YEAR FROM SYSDATE) FROM DUAL;
SELECT EXTRACT(YEAR FROM SYSTIMESTAMP) FROM DUAL;
SELECT EXTRACT(YEAR FROM COLUMN) FROM DUAL;
To extract MONTH from SYSDATE or SYSTIMESTAMP or Date/Timestamp column.
SELECT EXTRACT(MONTH FROM SYSDATE) FROM DUAL;
SELECT EXTRACT(MONTH FROM SYSTIMESTAMP) FROM DUAL;
SELECT EXTRACT(MONTH FROM COLUMN) FROM DUAL;
To extract DAY from SYSDATE or SYSTIMESTAMP or Date/Timestamp column.
SELECT EXTRACT(DAY FROM SYSDATE) FROM DUAL;
SELECT EXTRACT(DAY FROM SYSTIMESTAMP) FROM DUAL;
SELECT EXTRACT(DAY FROM COLUMN) FROM DUAL;
NOTE: Column should be in Date or Timestamp.
To extract YEAR from SYSDATE or SYSTIMESTAMP or Date/Timestamp column.
SELECT EXTRACT(YEAR FROM SYSDATE) FROM DUAL;
SELECT EXTRACT(YEAR FROM SYSTIMESTAMP) FROM DUAL;
SELECT EXTRACT(YEAR FROM COLUMN) FROM DUAL;
To extract MONTH from SYSDATE or SYSTIMESTAMP or Date/Timestamp column.
SELECT EXTRACT(MONTH FROM SYSDATE) FROM DUAL;
SELECT EXTRACT(MONTH FROM SYSTIMESTAMP) FROM DUAL;
SELECT EXTRACT(MONTH FROM COLUMN) FROM DUAL;
To extract DAY from SYSDATE or SYSTIMESTAMP or Date/Timestamp column.
SELECT EXTRACT(DAY FROM SYSDATE) FROM DUAL;
SELECT EXTRACT(DAY FROM SYSTIMESTAMP) FROM DUAL;
SELECT EXTRACT(DAY FROM COLUMN) FROM DUAL;
NOTE: Column should be in Date or Timestamp.