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.
valuable post! I really like and appreciate your work, thank you for sharing such a useful information about business intelligence management strategies, keep updating the information, hear i prefer some more information about jobs for your career hr jobs in hyderabad .
ReplyDelete