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:

  1. One year
  2. One option: Calendar month
  3. – Daytime
  4. The word “hour” refers to a period of time equal to sixty minutes.
  5. small amount of time
  6. 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.

bannerAds