top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

Facebook Login
Site Registration

What is the use of EXTRACT in Oracle?

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

Share this question
Facebook Share Button Twitter Share Button Google+ Share Button LinkedIn Share Button Multiple Social 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
Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...