Wednesday, July 20, 2011

Oracle Extract Function

This function is pretty much similar to SQL datepart function. Syntax is given below. This was taken from the below URL. 


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

You can take year, month and day separately using this function.


extract(YEAR FROM DATE '2011-07-20') would return 2011
extract(MONTH FROM DATE '2011-07-20') would return 7
extract(DAY FROM DATE '2011-07-20') would return 20

No comments:

Post a Comment

Retrieving Calendar of a Bookable Resource in Dynamics

There are occasions where we need to retrieve working days and working times of a resource in Dynamics grammatically. This is quite possible...