create or replace procedure MyProc
as
begin
declare cursor c is
select name from MYTABLETEST1;
v_record c%rowtype;
begin
open c;
loop
fetch c into v_record;
exit when c%notfound;
declare cursor twoc is
select name from mytabletest2 where instr(name,v_record.name) != 0;
v_result twoc%rowtype;
begin
open twoc;
loop
fetch twoc into v_result;
exit when twoc%notfound;
insert into MyTableTest3 values(1,v_result.name);
end loop;
close twoc;
end;
end loop;
close c;
end;
end MyProc;
oracle 游标demo
最新推荐文章于 2021-04-14 02:55:56 发布