Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: returning a constant set of numbers from a "select"

Re: returning a constant set of numbers from a "select"

From: programmer <int.consultNOCAPITALS_at_macmail.com>
Date: Mon, 21 Jul 2003 15:02:53 +0100
Message-ID: <bfgs9j$7e6$1@pheidippides.axion.bt.co.uk>


> i cannot guarentee that any tables which will be big enough to cover
> all of the potential ranges (pot. as large as 20-30k numbers) will be
> granted to all users of the application, so could use an example which
> does not rely on tables. i was thinking something along the lines of
> selecting from a stored procedure - but havnt got a clue how to go
> about it - any ideas?!

This will generate numbers up to 9,999,999. you could put in a WHERE or change the number of joins to modify the maximum number returned.

create table numbers (n integer);

insert into numbers values(0);
insert into numbers values(1);
insert into numbers values(2);
insert into numbers values(3);
insert into numbers values(4);
insert into numbers values(5);
insert into numbers values(6);
insert into numbers values(7);
insert into numbers values(8);
insert into numbers values(9);


select t6.n*1000000 + t5.n*100000 + t4.n*10000 +  t3.n*1000 + t2.n*100 + t1.n*10 + t0.n num from numbers t0, numbers t1, numbers t2, numbers t3, numbers t4, numbers t5, numbers t6
order by t6.n, t5.n, t4.n, t3.n, t2.n, t1.n, t0.n; Received on Mon Jul 21 2003 - 09:02:53 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US