DROP PROCEDURE IF EXISTS pro_rep_shadow_rs;create procedure pro_rep_shadow_rs(out rtn int)   
begin   
    -- 如果出现异常,会自动处理并rollback
    declare exit handler for  sqlexception ROLLBACK ;     

       
    -- 启动事务   
    start transaction;   
    insert into test_user values(NULL,1,'啊是大三的');
insert into test_user VALUES(NULL,23,'sdsd',ss); --故意写错的
       
    -- 运行没有异常,提交事务   
    commit;   
    -- 设置返回值为1  
    set rtn=1;   
end;   最终还是使用存储过程来执行事务,要方便的多