I have two date variables and I want to present the data in specific manner. So, my query is like this that shows the months name,
SELECT TO_CHAR (ADD_MONTHS (start_date, LEVEL - 1), 'fmMonth') months_namE
FROM (SELECT DATE '2012-01-01' start_date, DATE '2012-03-25' end_date
FROM DUAL)
CONNECT BY LEVEL <=
MONTHS_BETWEEN (TRUNC (end_date, 'MM'),
TRUNC (start_date, 'MM'))
* +1;
and the output is like this,
MONTHS_NAME
-----------
January
February
my intended output is like this
MONTHS_NAME | WEEK | DAYS
-------------------------
January 1 1
January 1 2
January 1 3
January 1 4
January 1 5
January 1 6
January 1 7
January 2 1
January 3
January 4
i tried numerous methods and cant make it work, please help me...
That should be easy using Row Generator method. Rest is only the format mask.
In SQL*Plus, my demo is between the dates '2012-01-01' and '2012-02-20':
Result