I applied an orientation of another topic and it worked cool when you only have one record in the table with the range, but I had problems when the same record has more than one date range.

Using the query below:

```
select trunc(to_date(X.DT_ENTRADA)) + (level-1) periodo
from dual
connect BY level <= to_number(to_date(X.DT_SAIDA) - TO_DATE(X.DT_ENTRADA)) + 1
```

and having the table "INPUTS" below as an example:

```
ID DT_ENTRADA DT_SAIDA CD_PESSOA
1 01/01/2018 05/01/2018 123
2 03/01/2018 07/01/2018 123
3 10/03/2018 15/03/2018 999
4 15/03/2018 17/03/2018 999
```

How would I mount a single list containing all the days between these grouped intervals per person? That is:

```
PERIODO ID CD_PESSOA
01/01/2018 1 123
02/01/2018 1 123
03/01/2018 1 123
03/01/2018 2 123
04/01/2018 1 123
04/01/2018 2 123
05/01/2018 1 123
05/01/2018 2 123
06/01/2018 2 123
07/01/2018 2 123
```

If you have a way to build the list containing only the distinct ones better still, otherwise I want to use the good old `DISTINCT`

on the list dates.

I tried to adapt it as follows:

```
SELECT DISTINCT trunc(to_date(X.DT_ENTRADA) + (LEVEL - 1),
X.ID
FROM (
SELECT Y.ID,
Y.DT_ENTRADA,
Y.DT_SAIDA,
Y.CD_PESSOA
FROM ENTRADAS Y
WHERE Y.CD_PESSOA = 123
) X
CONNECT BY LEVEL <= to_number(to_date(X.DT_SAIDA) - TO_DATE(X.DT_ENTRADA)) + 1
```

But it did not roll. The result comes in the same proportion of a Geometric Progression (1,2,4,8,16 ...), that is, in this example it will return:

1x `01/01/2018`

, 2x `02/01/2018`

, 4x `03/01/2018`

, 8x `04/01/2018`

and 16x `05/01/2018`

for `ID 1`

and%
1x `03/01/2018`

, 2x `04/01/2018`

, 4x `05/01/2018`

, 8x `06/01/2018`

and 16x `07/01/2018`

for `ID 2`

.

Thanks for the help.