Home » SQL & PL/SQL » SQL & PL/SQL » Dispaly all Dates of Month
icon9.gif  Dispaly all Dates of Month [message #210080] Tue, 19 December 2006 05:05 Go to next message
asgharmayo
Messages: 5
Registered: March 2006
Location: Faisalabad
Junior Member
All dba
Hy
i need a query which return all dates of a month
output:
01-01-2006
02-01-2006
03-01-2006
.
.
.

.

.

31-01-2006
asghar
Re: Dispaly all Dates of Month [message #210084 is a reply to message #210080] Tue, 19 December 2006 05:22 Go to previous messageGo to next message
Maaher
Messages: 7065
Registered: December 2001
Senior Member
Have a look at the orafaq wiki and don't be afraid to use the search button of the forum.

MHE
Re: Dispaly all Dates of Month [message #210325 is a reply to message #210080] Wed, 20 December 2006 06:44 Go to previous messageGo to next message
rameshuddaraju
Messages: 69
Registered: June 2005
Location: India
Member


SQL> select to_char ( trunc(sysdate,'month') + rownum-1 , 'dd-mm-yyyy' ) Month_days from emp,dept
where trunc(sysdate,'month')+ rownum-1 <= last_day(sysdate)


emp,dept is used only to generate the rows
for rownum.
emp contains 14 rows and dept contains 4 rows so that total of 56 rows can be generated with the product of these two tables.
Re: Dispaly all Dates of Month [message #210329 is a reply to message #210325] Wed, 20 December 2006 06:56 Go to previous message
Maaher
Messages: 7065
Registered: December 2001
Senior Member
@rameshuddaraju: that's a row generator technique mentioned in the article. Wink

No new information.

MHE
Previous Topic: DBMS_SCHEDULER
Next Topic: how to print output of all days of a month using sql
Goto Forum:
  


Current Time: Fri May 03 18:28:35 CDT 2024