modelたとえば、句を使用してこれを実現できます。
with t1(ID, Period) as(
select 1, 5 from dual union all
select 2, 3 from dual union all
select 3, 2 from dual
)
select ID
, period as hour
from t1
model
partition by (ID)
dimension by (1 as indx)
measures(period)
rules(
period[for indx from 1 to period[1] increment 1] = cv(indx)
)
SQLFiddle デモ
結果:
ID HOUR
---------- ----------
1 1
1 2
1 3
1 4
1 5
2 1
2 2
2 3
3 1
3 2
10 rows selected
そして、insertステートメントは次のようになります。
insert into t2(id, hour)
select ID
, period
from t1
model
partition by (ID)
dimension by (1 as indx)
measures(period)
rules(
period[for indx from 1 to period[1] increment 1] = cv(indx)
)