1、需要用到游标:
create or replace procedure test_procedure is --a表游标定义 cursor a_cursor is select substr(mc,2) as str,mc as mcs from t_bz_zd_xzqh_jc; --b表游标定义 cursor b_cursor(str1 string) is SELECT bm FROM t_bz_zd_xzqh where mc like '%' || str1 || '%'; -- instr(mc,str1) > 0; begin for a_cur in a_cursor loop for b_cur in b_cursor(a_cur.str) loop --这里是你要执行的操作,比如insert到c --insert into c values (b_cur.id); update t_bz_zd_xzqh_jc set bh= b_cur.bm where mc = a_cur.mcs ; commit; end loop; end loop; end;原文链接:https://www.f2er.com/oracle/213438.html