免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
12下一页
最近访问板块 发新帖
查看: 5077 | 回复: 11

如何获取存储过程中insert语句中的结果集?? [复制链接]

论坛徽章:
1
操作系统版块每日发帖之星
日期:2016-02-12 06:20:00
发表于 2008-06-28 14:23 |显示全部楼层
我在存储过程中有一个v_sql:='insert into a select * from b '语句,当使用
execute immediate v_sql ;
我用什么办法把插入的记录数赋值给一个变量呀?
请各位高手帮忙!!

论坛徽章:
0
发表于 2008-06-28 20:14 |显示全部楼层
v_str:='INSERT INTO rybo006mid1 ';
                v_str:=v_str||' SELECT SUBSTR(c.org_code,1,2),SUBSTR(c.org_code,3,2),a.unit_id,a.id_no, ';
                v_str:=v_str||' a.phone_no,prepay_fee,back_fee,b.login_no,a.op_time ';
                v_str:=v_str||' FROM dddd a ,'||v_table_name||' b , Login c ';
                v_str:=v_str||' WHERE a.id_no =b.id_no  AND a.login_accept=b.login_accept ';
                v_str:=v_str||' AND a.op_type=''8'' AND a.back_flag=''Y''  ';
                v_str:=v_str||' AND b.op_code=''1336'' AND b.login_no=c.login_no ';
                v_str:=v_str||' AND b.login_no=:bin_login_no ';               
                v_str:=v_str||' AND a.op_time >=:bin_begin_time ';
                v_str:=v_str||' AND a.op_time <=:bin_end_time  ';
        EXECUTE IMMEDIATE v_str USING
                rpad(in_login_no,6,' '),
                to_date(in_begin_time,'yyyymmdd hh24:mi:ss'),
                to_date(in_end_time,'yyyymmdd hh24:mi:ss');

论坛徽章:
1
丑牛
日期:2014-08-07 17:07:05
发表于 2008-07-01 13:50 |显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽

论坛徽章:
1
操作系统版块每日发帖之星
日期:2016-02-12 06:20:00
发表于 2008-07-04 20:17 |显示全部楼层
2楼的方法不对呀??

难道没有高人可以指点了吗?

论坛徽章:
1
操作系统版块每日发帖之星
日期:2016-02-12 06:20:00
发表于 2008-07-04 20:20 |显示全部楼层
2楼的应该是把输入参数应用到insert语句中去,而不是获得结果集!

论坛徽章:
1
操作系统版块每日发帖之星
日期:2016-02-12 06:20:00
发表于 2008-07-15 16:44 |显示全部楼层
期待高手解决

论坛徽章:
0
发表于 2008-07-15 16:55 |显示全部楼层
cursor  c_sql  is
  select * from b

论坛徽章:
0
发表于 2008-07-17 22:25 |显示全部楼层
原帖由 ILoveMK 于 2008-7-1 13:50 发表
select count(*) into v_count from b;


这个不行么

论坛徽章:
0
发表于 2008-07-18 09:02 |显示全部楼层
原帖由 yslaoniu 于 2008-7-17 22:25 发表


这个不行么

结果集不是行数。

论坛徽章:
0
发表于 2008-07-18 15:38 |显示全部楼层
比较这张表插入前后的行数差不就可以了
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP