Pages

OracleEBSpro is purely for knowledge sharing and learning purpose, with the main focus on Oracle E-Business Suite Product and other related Oracle Technologies.

I'm NOT responsible for any damages in whatever form caused by the usage of the content of this blog.

I share my Oracle knowledge through this blog. All my posts in this blog are based on my experience, reading oracle websites, books, forums and other blogs. I invite people to read and suggest ways to improve this blog.


Wednesday, February 27, 2013

Oracle/PLSQL: Extract Function


n Oracle/PLSQL, the extract function extracts a value from a date or interval value.

Syntax

The syntax for the extract function 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

  • Oracle 11g, Oracle 10g, Oracle 9i

For Example

extract(YEAR FROM DATE '2003-08-22')would return 2003
extract(MONTH FROM DATE '2003-08-22')would return 8
extract(DAY FROM DATE '2003-08-22')would return 22

No comments:

Post a Comment