Oracle Database A Simple Integer Generator


Example

Query:

WITH generator ( value ) AS (
  SELECT 1 FROM DUAL
UNION ALL
  SELECT value + 1
  FROM   generator
  WHERE  value < 10
)
SELECT value
FROM   generator;

Output:

VALUE
-----
    1
    2
    3
    4
    5
    6
    7
    8
    9
   10