SQL codewith cte as(
select '10001' BeginResId, '10005' EndResId, 5 count, 100 price from dual
union all
select '10007', '10012', 6, 200 from dual
)
select beginresid+level-1 resid,price from cte
connect by level<=count and prior price=price and
prior dbms_random.value is not null;
结果为:
RESID PRICE
---------------------- ----------------------
10001 100
10002 100
10003 100
10004 100
10005 100
10007 200
10008 200
10009 200
10010 200
10011 200
10012 200
11 rows selected