oracle的双重for循环
发布时间:2020-12-12 16:14:08 所属栏目:百科 来源:网络整理
导读: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
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; (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- ruby-on-rails – Rails 3.1:具有命名路由的资产管道
- IAR for AVR 学习笔记
- 仿百度文库方案[openoffice.org 3+swftools+flexpaper](四)
- flex – 如何将MXML文件内嵌到另一个MXML文件中?
- c# – Reflection.Emit私有字段/属性访问
- 线程1:EXC_BAD_ACCESS(代码= 1,地址= 0x0)标准C内存问题
- 使用pg_rman软件来实现postgresql数据库的备份恢复
- ruby-on-rails – Ruby on Rails中的多个用户角色
- swift – 在尝试使用主线程时不明确地使用DispatchQueue
- c# – 如何拦截对.NET程序中文件的访问