дано
with xxx as (
select 1 as id, 0 as be, 10 as en from dual
union all
select 2 as id, 11 as be, 35 as en from dual
union all
select 3 as id, 36 as be, 50 as en from dual
union all
select 4 as id, 51 as be, null as en from dual
union all
select 5 as id, 0 as be, 45 as en from dual
union all
select 6 as id, 46 as be, 10 as en from dual
union all
select 7 as id, 0 as be, null as en from dual
)
select * from xxx;
подскажите как получить
1 1 0 10
2 1 11 35
3 1 36 50
4 1 51
5 2 0 45
6 2 46 10
7 3 0
те идентификатор группы, в которой есть полное множество от 0 до бесконечности, представленной null.
Предполагается, что входные данные корректны и пропусков между интервалами в группе нет.