PL/SQL EXTRACT function for oracle datetime

      1 Comment on PL/SQL EXTRACT function for oracle datetime
0 Flares Twitter 0 Facebook 0 Google+ 0 LinkedIn 0 Buffer 0 Email -- Filament.io 0 Flares ×

The EXTRACT function extracts and returns the value of a specified datetime field from a datetime.It can also be used for extracting specified value from an interval value expression.

This can be used to extract the following from a specified datetime field.
YEAR,MONTH,DAY,HOUR,MINUTE,SECOND
TIMEZONE_HOUR,TIMEZONE_MINUTE,TIMEZONE_REGION,TIMEZONE_ABBR

EXAMPLES :

Extracting Year

SQL> select EXTRACT(YEAR FROM DATE '2008-11-11')YEAR from dual;
     YEAR
    2008
SQL>

Extracting Minute

SQL> select EXTRACT(MINUTE FROM TIMESTAMP '2008-11-11 11:32:20')MINUTE from dual;
MINUTE
 32

SQL>

Extracting TIMEZONE_REGION

SQL> select EXTRACT(TIMEZONE_REGION FROM TIMESTAMP '01-01-08 11:53:42 Pacific/Midway')TIMEZONE_REGION from dual;<
TIMEZONE_REGION
Pacific/Midway

SQL>

Also Read,

Technorati Tags:
, , , , , , ,

0 Flares Twitter 0 Facebook 0 Google+ 0 LinkedIn 0 Buffer 0 Email -- Filament.io 0 Flares ×

1 thought on “PL/SQL EXTRACT function for oracle datetime

  1. Pingback: ORA-01882: TIMEZONE REGION NOT FOUND |Oracle Error | SQL and PLSQL

Leave a Reply

Your email address will not be published. Required fields are marked *

Paged comment generated by AJAX Comment Page