oracle 游标demo
来源:互联网 发布:身份证怎么网络挂失 编辑:程序博客网 时间:2024/05/17 07:11
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;