I don't think this can be achieved elegantly without a function. But
from a pure novelty point of view, you may try this.
I am making the assumption here your environment has set the
NLS_DATE_FORMAT to 'DD-MON-YYYY'.

SELECT DECODE(TO_CHAR(TO_DATE('17-jan-2009'),'D'),2,TO_DATE('17-
jan-2009'),
              TO_DATE('1-jan-'||TO_CHAR(TO_DATE('17-
jan-2009'),'YYYY'),'DD-MON-YYYY')+(7-TO_CHAR(TO_DATE('1-jan-'||TO_CHAR
(TO_DATE('17-jan-2009'),'YYYY'),'DD-MON-YYYY'),'D')+1))
FROM DUAL

The decode is to check for the day if 1-jan is a Sunday. Comes into
effect if the year is changed to 2006.

I wrote this right off the bat and tested it. But I am sure it can be
easily further improved.

z1hou1
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Oracle PL/SQL" group.
To post to this group, send email to Oracle-PLSQL@googlegroups.com
To unsubscribe from this group, send email to
oracle-plsql-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/Oracle-PLSQL?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to