Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: create set of numbers
TKX for input.
The range must be neatless!
More info: the DB should allocate an inventory number for goods which are in a given range. Already used numbers are saved in a table (with other information too). The used numbers obey no mathematical or logical order.
So i have to choose a number which is NOT in the set of already used numbers and i want to avoid creating a dummy table for this purpose.
Venkat schrieb:
>
> How many numbers you have in that range? If you only want those 9 numbers,
> you can use the following (kind of awkward) sql:
>
> select int1 from table1
> minus
> (select 1.000.000.000 from dual
> union
> select 2.000.000.000 from dual
> union
> select 3.000.000.000 from dual
> union
> select 4.000.000.000 from dual
> union
> select 5.000.000.000 from dual
> union
> select 6.000.000.000 from dual
> union
> select 7.000.000.000 from dual
> union
> select 8.000.000.000 from dual
> union
> select 9.000.000.000 from dual);
>
> Johann Höchtl <big.john_at_bigfoot.com> wrote in message
> news:375E9AA8.ADBF0A50_at_bigfoot.com...
> > Hi!
> >
> > This is MAYBE a true sql-question and not oracle specific.
> >
> > I have the Problem to create a set of numbers between, say 1.000.000.000
> > and 9.000.000.000 and join it using 'minus select' against integers in
> > an existing table in order to get the set of numbers between 1.00... and
> > 9.000.... which are NOT in the existing Table.
> >
> > To do this, do i really have to create a dummy-table and fill an
> > integer-column completely with values from 1... to 9..... or is there an
> > on-the-fly-way ?
> >
> > Regards,
> > John
Received on Wed Jun 09 1999 - 12:55:29 CDT