top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

What is the use of EXTRACT in Oracle?

+2 votes
408 views
What is the use of EXTRACT in Oracle?
posted Aug 5, 2015 by Archana

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote
 
Best answer

DESCRIPTION

The Oracle/PLSQL EXTRACT function extracts a value from a date or interval value.

SYNTAX

The syntax for the EXTRACT function in Oracle/PLSQL is:

EXTRACT (
{ YEAR | MONTH | DAY | HOUR | MINUTE | SECOND }
| { TIMEZONE_HOUR | TIMEZONE_MINUTE }
| { TIMEZONE_REGION | TIMEZONE_ABBR }
FROM { date_value | interval_value } )

Note:

You can only extract YEAR, MONTH, and DAY from a DATE.

You can only extract TIMEZONE_HOUR and TIMEZONE_MINUTE from a timestamp with a time zone datatype.

APPLIES TO

The EXTRACT function can be used in the following versions of Oracle/PLSQL:

Oracle 12c, Oracle 11g, Oracle 10g, Oracle 9i

EXAMPLE

Let's look at some Oracle EXTRACT function examples and explore how to use the EXTRACT function in Oracle/PLSQL.

For example:

EXTRACT(YEAR FROM DATE '2003-08-22') Result: 2003

EXTRACT(MONTH FROM DATE '2003-08-22') Result: 8

EXTRACT(DAY FROM DATE '2003-08-22') Result: 22

answer Aug 6, 2015 by Manikandan J
...