SQL Query Problem [message #200049] |
Fri, 27 October 2006 12:07  |
pankyz
Messages: 11 Registered: October 2006
|
Junior Member |

|
|
Hi Guys,
Joined this forum just recently. I have a Problem in SQL that i want to display 50 dates on using sql for.eg starting date is 1st april,2006 and now i want to display 50 dates from that date onward.I dont want to use any cursor or procedure..Just wanna do it using Query.
Thanks
|
|
|
Re: SQL Query Problem [message #200070 is a reply to message #200049] |
Fri, 27 October 2006 14:12   |
andrew again
Messages: 2577 Registered: March 2000
|
Senior Member |
|
|
select trunc(sysdate) + level from dual
connect by level <= 10;
TRUNC(SYSDATE)+LEVEL
10/28/2006
10/29/2006
10/30/2006
10/31/2006
11/1/2006
11/2/2006
11/3/2006
11/4/2006
11/5/2006
11/6/2006
Test it thouroghly...
|
|
|
|
|
|
|
|
|
Re: SQL Query Problem [message #200330 is a reply to message #200121] |
Mon, 30 October 2006 06:48   |
S.Rajaram
Messages: 1027 Registered: October 2006 Location: United Kingdom
|
Senior Member |
|
|
Can anybody explain to me why am i getting an output like this. I am asking this out of my own curiosity.
SQL> create table test (sno number);
Table created.
SQL> insert into test values (10);
1 row created.
SQL> commit;
Commit complete.
SQL> select * from test;
SNO
----------
10
SQL> select level from (select max(sno) rnum from test)
2 connect by level <= rnum;
LEVEL
----------
1
2
3
4
5
6
7
8
9
10
10 rows selected.
SQL> select level, rnum from (select 10 rnum from dual)
2 connect by level <= rnum;
LEVEL RNUM
---------- ----------
1 10
Thanks in advance
cheers
OOPS I forgot to tell you i am on Oracle 9i.
[Updated on: Mon, 30 October 2006 06:49] Report message to a moderator
|
|
|
|