|
不用LATERAL, 用传统的CONNECT BY写法:
insert into range_result2
with b as (
select b.*,trunc(start_id/10000)+level-1 as compare_id
from range_b b
connect by start_id=prior start_id and end_id=prior end_id
and level<=trunc(end_id/10000)-trunc(start_id/10000)+1
and prior sys_guid() is not null
)
select a.id,b.type from range_a a,b where trunc(a.id/10000)=b.compare_id and a.id between b.start_id and b.end_id
;
|
|