Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create a list

Status
Not open for further replies.

TheRealDeal

Technical User
Nov 16, 2001
187
US
Is it possible:

Create a dual table with one field that starts at 1 and goes to 100 WITHOUT using unions or referencing another table that has 100+ records?

My use of the table is to populate a dropdown in another application.
 
Real,

To instantly create any number of rows you need without having to actually CREATE some driving table, this is code that you can use (in Oracle 10g and above, only):
Code:
SELECT LEVEL real_deal
  FROM dual
  CONNECT BY LEVEL <=15
/

REAL_DEAL
---------
        1
        2
        3
        4
        5
        6
        7
        8
        9
       10
       11
       12
       13
       14
       15
Let us know if this resolves your need.

[santa]Mufasa
(aka Dave of Sandy, Utah, USA)
[I provide low-cost, remote Database Administration services: www.dasages.com]
“Beware of those that seek to protect you from harm or risk. The cost will be your freedoms and your liberty.”
 
OK. I think I am understanding. I also found the following that the users said they preferred. However, I cannot easily break it apart.

select integer_value
from dual
where 1=2
model
dimension by ( 0 as key )
measures ( 0 as integer_value )
rules upsert ( integer_value[ for key from 1 to 10 increment 1 ] = > cv(key) )

Can you help me understand this?
 
Hi,
I'm sure Santa will post an elegant explanation soon, but in the meantime try this from o'Reilly:


I do not see why the users would prefer it to Santa's method however, if all you want to do is generate the list of numbers...



[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
TurkBear,

You very kindly overestimated my knowledge base. I've never seen the type of code that RealDeal posted, and I shall gladly defer to O'Reilly. If I wasn't under the gun to complete a data model presently, I'd go out and educate myself, then pass along the new knowledge. I'll hope that you or RD can brief the rest of us. [2thumbsup]

[santa]Mufasa
(aka Dave of Sandy, Utah, USA)
[I provide low-cost, remote Database Administration services: www.dasages.com]
“Beware of those that seek to protect you from harm or risk. The cost will be your freedoms and your liberty.”
 
Hi,
Amazing...I also have never used or read much about that code so I guess we both can rely on O'Reilly ( sounds like a marketing jingle..[wink])



[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top