Oracle EXTRACT Function Guide
The EXTRACT function in Oracle is used to extract specific parts from a date/time expression, such as year, month, day, hour, minutes, etc. The basic syntax is as follows:
EXTRACT(unit FROM date_expression)
Unit represents the portion to be extracted, which can be one of the following values:
- One year
- One option: Calendar month
- – Daytime
- The word “hour” refers to a period of time equal to sixty minutes.
- small amount of time
- Next
For example, to extract the year from a date column, you can use the EXTRACT function like this:
SELECT EXTRACT(YEAR FROM hire_date) AS year
FROM employees;
The goal is to extract the year from the hire_date column in the employees table. By using the EXTRACT function in combination with other functions and conditions, more complex date/time processing can be achieved.