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

Home -> Community -> Usenet -> c.d.o.server -> Re: Getting NON-existing data

Re: Getting NON-existing data

From: Alton Ayers <altona_at_ditw.com>
Date: Fri, 25 Jun 1999 08:57:31 -0400
Message-ID: <37737CBB.64520312@ditw.com>


Here is a trick I've used before:

SELECT rownum id FROM

 (SELECT * FROM dual UNION ALL SELECT * FROM dual),
 (SELECT * FROM dual UNION ALL SELECT * FROM dual),
 (SELECT * FROM dual UNION ALL SELECT * FROM dual),
 (SELECT * FROM dual UNION ALL SELECT * FROM dual)
/

This example will give you sixteen ids. By adding more "(SELECT * FROM dual UNION ALL SELECT * FROM dual)," you can go as high as you wish. Each additional one will double the output.

Niek Kerkemeijer wrote:

> Hi,
>
> I have a nice question:
> I need oracle to generate a number-range for me without having
> a table containing these values.
>
> Example:
> I have an empty database (there are no tables in it) and I need
> a query which results in the following:
>
> +------+
> | id |
> +------+
> | 1 |
> | 2 |
> | 3 |
> | 4 |
> | 5 |
> | 6 |
> | 7 |
> | 8 |
> | 9 |
> | 10 |
> +------+
>
> Any ideas?
>
> Niek.
Received on Fri Jun 25 1999 - 07:57:31 CDT

Original text of this message

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