在MySql中,如果Table类型为MYISAM,则插入数据时,除非在插入第一条记录时就出错了,否则rollback时不会删除已插入的数据。

mysql>create procedure tran_test(in a int)

       ->begin

       ->start transaction;

       ->insert into user value ('15','ttt','123456');

       ->if a>1 then

       ->rollback;

       ->end if ;

      ->commit;

      ->end ||

测试:mysql>call tran_test(7);   //数据不能插入。

          mysql>call   tran_test(0);   //数据可以插入。

posted on 2011-03-31 16:25  风生水起  阅读(332)  评论(0编辑  收藏  举报