June 16, 2009 at 2:30 am
Hi,
I'm doing some work in Oracle on date ranges, and have a calendar table with Activity_date. I'd like to calculate the "relative week no." from this, but I'm not sure of the functions to use...
In MS SQL it was just easy to use datediff, but there is not such function in Oracle, as the dates are stored as numbers....
Anyone point me in the right direction
Thx..
June 16, 2009 at 8:40 pm
Jason Coleman (6/16/2009)
as the dates are stored as numbers....Anyone point me in the right direction
Thx..
The dates should be stored as the Date datatype. What is the data type of the column the dates are stored in?
--Jeff Moden
Change is inevitable... Change for the better is not.
June 17, 2009 at 3:11 am
Right... finally started thinking straight...
select
activity_date,
to_char(activity_date,'IW')-to_char(sysdate,'IW') as Date_diff
from
dw.calendar
and then hey presto! :w00t:
June 17, 2009 at 8:48 am
Jason Coleman (6/17/2009)
Right... finally started thinking straight...
select
activity_date,
to_char(activity_date,'IW')-to_char(sysdate,'IW') as Date_diff
from
dw.calendar
and then hey presto! :w00t:
Outstanding. Thanks for the feedback on this, Jason.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply