create
or
replace
procedure
test_procedure
is
--a表游标定义
cursor
a_cursor
is
select
id
from
a;
--b表游标定义
cursor
b_cursor(aid number)
is
select
id
from
b
where
b.id = aid;
begin
for
a_cur
in
a_cursor loop
for
b_cur
in
b_cursor(a_cur.id) loop
--这里是你要执行的操作,比如insert到c
insert
into
c
values
(b_cur.id);
commit
;
end
loop;
end
loop;