How generate a list of rows of numers in a range in HSQLDB?

hsqldb, sql

Solution

HyperSQL (as HSQLDB is now called) has a function similar to Postgres' `generate_series()`. Using `sequence_array` together with the `unnest()` function you can generate a list of values:

insert into numbers (some_number)
select nr
from unnest(sequence_array(1, 100, 1)) as i(nr)

If you want to start with a different number, just supply that as an argument to the `sequence_array` function.

insert into numbers (some_number)
select nr
from unnest(sequence_array(50000, 59999, 1)) as i(nr)

Problem

How generate a list of rows of numers in a range in HSQLDB? I need to insert a whole range of numbers in the base. something like this ``` INSERT INTO numers VALUES (50001) (50002) ... (59999) ``` In oracle, is can be done with "CONNECT BY LEVEL", but how can i do it in HSQLDB?

Original source