Wednesday, November 18, 2009

ORACLE Same weekday last year

How to get the same weekday last year:
select
case when
to_number(to_char(to_date('28-FEB-2009'),'d') )
-
to_number(to_char(add_months(to_date('28-FEB-2009'),-12),'d') )= 0
then
add_months(to_date('28-FEB-2009'),-12)
else
next_day(add_months(to_date('28-FEB-2009'),-12), to_number(to_char(to_date('28-FEB-2009'),'d') ))
end as DAY_LAST_YEAR_SAME_WEEK_DAY
from
dual;
Till Next Time

Tuesday, May 5, 2009

ORACLE Forcing the listener to listen

show parameter local listener
-- if the above is empty
alter system set local_listener='(address=(protocol=tcp)(host=localhost)(port=1521))';
alter system register;

Till Next Time