Oracle PL/SQL

Monday, September 04, 2006

How to print Dates and Days for a Month

Here's the query :-

SELECT TO_DATE ('01/01/2006', 'dd/mm/yyyy') + ROWNUM - 1 MONTH_DATE,
TO_CHAR (TO_DATE ('01/01/2006', 'dd/mm/yyyy') + ROWNUM - 1, 'day') MONTH_DAY
FROM
ALL_OBJECTS
WHERE
ROWNUM <= 31;

The only hitch is the 31 - I guess I'll figure out a workaround for that too :)

0 Comments:

Post a Comment

<< Home