ITPub博客

首页 > Linux操作系统 > Linux操作系统 > mysql & oracle savepoint 使用方法

mysql & oracle savepoint 使用方法

原创 Linux操作系统 作者:season0891 时间:2009-07-17 11:15:41 0 删除 编辑
oracle savepoint:
begin
savepoint a;
insert into ages values(1,'age');
insert into ages values(1,'age');
insert into ages values(1,'age');
insert into ages values(1,'age11111111111111111111111111');
exception when others then
  begin
    rollback to a;
  end ;
commit;
end ;

mysql savepoint :

start transaction;
savepoint a;
insert into t set id =10;
insert into t set id =21;
insert into t set id =31;
rollback to savepoint a;


start transaction;
set @b=0;
declare continue handler for SQLEXCEPTION set @b=1;
savepoint a;
insert into t set id =10;
insert into t set id =21;
insert into tt set id =31;
if @b=1 then
rollback to savepoint a;
end if;

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/90618/viewspace-609493/ ,如需转载,请注明出处,否则将追究法律责任。

上一篇: oracle 监控脚本
下一篇: 一段shell 脚本
请登录后发表评论 登录
全部评论

注册时间:2008-06-10

  • 博文量
    790
  • 访问量
    2098017