Home » SQL & PL/SQL » SQL & PL/SQL » Generate Rows
Generate Rows [message #233717] Fri, 27 April 2007 04:12 Go to next message
ehegagoka
Messages: 493
Registered: July 2005
Senior Member
Hi,
Is there a way on how can I generate a result like this


   COL   COL2
   ----  ---
   41    50
   31    40
   21    30
   11    20




Thanks, I'm just thinking if there's a way that I dont need to hard code it in my select, because I will use those two columns in filtering the range.

Regards,
Rhani
Re: Generate Rows [message #233718 is a reply to message #233717] Fri, 27 April 2007 04:14 Go to previous messageGo to next message
Michel Cadot
Messages: 64119
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Where the numbers come from if they are not hard coded?

Regards
Michel
Re: Generate Rows [message #233780 is a reply to message #233717] Fri, 27 April 2007 08:01 Go to previous messageGo to next message
joy_division
Messages: 4640
Registered: February 2005
Location: East Coast USA
Senior Member
select col1, col2
from table1
order by col1 desc;
Re: Generate Rows [message #233802 is a reply to message #233780] Fri, 27 April 2007 09:06 Go to previous messageGo to next message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
You could try:
select lvl-9,lvl
from (select level*10 lvl
      from   dual
      connect by level <=5
Re: Generate Rows [message #233803 is a reply to message #233802] Fri, 27 April 2007 09:11 Go to previous message
Michel Cadot
Messages: 64119
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
With : "order by 1 desc". Wink

Regards
Michel
Previous Topic: listing tables with more than n rows
Next Topic: how do I prevent Oracle from invoking a time-consuming table function unnecesarily?
Goto Forum:
  


Current Time: Tue Dec 06 10:05:44 CST 2016

Total time taken to generate the page: 0.13005 seconds