查看: 25252|回复: 17

[PL/SQL] 请教大家一个问题,存储过程中需要几个commit?

[复制链接]
论坛徽章:
23
问答徽章
日期:2013-11-05 21:18:30马上有房
日期:2014-08-05 10:50:02天蝎座
日期:2016-05-16 16:23:25
1#
发表于 2013-12-2 15:51 | 显示全部楼层
如果中间有语句发生错误就不一样了,写了一个测试的例子,看看对你有帮助没有
drop table aatest;
create table aatest
(nid number,nname varchar2(16))
insert into aatest(nid,nname)values(1,'00');
commit;
create or replace procedure aatesta
as
begin
   update aatest set nname='step1' where nid=1;
   commit;
   update aatest set nname='step2' where nid=1;
   commit;
   update aatest set nname='step3_12345678910101010101' where nid=1;
   commit;
   exception when others then
     rollback;
end;
create or replace procedure aatestb
as
begin
   update aatest set nname='step1' where nid=1;
   update aatest set nname='step2' where nid=1;
   update aatest set nname='step3_12345678910101010101' where nid=1;
   commit;
   exception when others then
     rollback;
end;

使用道具 举报

回复

您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

TOP技术积分榜 社区积分榜 徽章 团队 统计 知识索引树 积分竞拍 文本模式 帮助
  ITPUB首页 | ITPUB论坛 | 数据库技术 | 企业信息化 | 开发技术 | 微软技术 | 软件工程与项目管理 | IBM技术园地 | 行业纵向讨论 | IT招聘 | IT文档
  ChinaUnix | ChinaUnix博客 | ChinaUnix论坛
CopyRight 1999-2011 itpub.net All Right Reserved. 北京盛拓优讯信息技术有限公司版权所有 联系我们 未成年人举报专区 
京ICP备16024965号-8  北京市公安局海淀分局网监中心备案编号:11010802021510 广播电视节目制作经营许可证:编号(京)字第1149号
  
快速回复 返回顶部 返回列表