存储过程之游标
来源:互联网 发布:改变世界的九大算法 编辑:程序博客网 时间:2024/05/01 03:52
declare cur02 cursor local static scroll for
select gend_option,gend_name
from gend_det
where gend_gen = @ipq_part_3
and (rtrim(gend_char1) = '' or (charindex(rtrim(@ipq_cx) + ',', rtrim(gend_char1) + ',')) > 0)
open cur02
fetch first from cur02 into @tmp_option,@tmp_name
while @@fetch_status = 0
begin
select @ipq_line = @ipq_line + 10
select @sql='insert into #rst(r_part,r_option,r_require,r_rmks) (select '''+rtrim(@ipq_part)+''','''+rtrim(@tmp_option)+''',a'+rtrim(@tmp_option)+'a, r+'' ''+x+str(y) from t_ipqc$ where l='''+rtrim(@ipq_part)+''')'
exec(@sql)
select @temp_require = r_require from #rst where r_part=@ipq_part and r_option=@tmp_option
select @temp_rmks = r_rmks from #rst where r_part=@ipq_part and r_option=@tmp_option
insert into ipqd_det (ipqd_nbr,ipqd_line,ipqd_method,ipqd_project,ipqd_rst1,ipqd_rmks)
values(@ipq_nbr,@ipq_line,@tmp_name,'',isnull(@temp_require,''),isnull(@temp_rmks,''))
fetch next from cur02 into @tmp_option,@tmp_name
end
close cur02
deallocate cur02
select gend_option,gend_name
from gend_det
where gend_gen = @ipq_part_3
and (rtrim(gend_char1) = '' or (charindex(rtrim(@ipq_cx) + ',', rtrim(gend_char1) + ',')) > 0)
open cur02
fetch first from cur02 into @tmp_option,@tmp_name
while @@fetch_status = 0
begin
select @ipq_line = @ipq_line + 10
select @sql='insert into #rst(r_part,r_option,r_require,r_rmks) (select '''+rtrim(@ipq_part)+''','''+rtrim(@tmp_option)+''',a'+rtrim(@tmp_option)+'a, r+'' ''+x+str(y) from t_ipqc$ where l='''+rtrim(@ipq_part)+''')'
exec(@sql)
select @temp_require = r_require from #rst where r_part=@ipq_part and r_option=@tmp_option
select @temp_rmks = r_rmks from #rst where r_part=@ipq_part and r_option=@tmp_option
insert into ipqd_det (ipqd_nbr,ipqd_line,ipqd_method,ipqd_project,ipqd_rst1,ipqd_rmks)
values(@ipq_nbr,@ipq_line,@tmp_name,'',isnull(@temp_require,''),isnull(@temp_rmks,''))
fetch next from cur02 into @tmp_option,@tmp_name
end
close cur02
deallocate cur02
0 0
- 存储过程之游标
- 存储过程之游标
- MySQL 存储过程之游标
- oracle存储过程之游标
- mysql存储过程之游标
- mysql存储过程之游标
- ORACLE存储过程实战之二:游标
- 传智播客学习之存储过程与游标
- mysql存储过程之游标遍历数据表
- DB2存储过程之游标AND UPDATE
- SQL Server 存储过程之嵌套游标
- 数据库开发之存储过程、触发器、游标
- mysql存储过程之游标使用
- ORACLE存储过程(四)之游标
- SQL Server 存储过程之嵌套游标
- mysql存储过程之游标遍历数据表
- SQL Server 存储过程之嵌套游标
- mysql存储过程之游标遍历数据表
- Python 函数式编程之 filter()、map()和reduce()
- ppp拨号过程
- Shell编写脚本的笔记
- springMVC学习笔记一(hello world)
- MongoDB基本使用
- 存储过程之游标
- [LeetCode]Sqrt(x)
- HDU1245:Saving James Bond(Floyd)
- php 简单的二分法查找
- 在C#中使用官方驱动操作MongoDB
- springMVC学习笔记二(dispatcherServlet)
- 关于网上盛传的iPhone锁屏界面的设计
- 【PAT (Advanced Level)】1049. Counting Ones (30)
- Linux命令 tail 加过滤功能