事务

begin;
insert into products values(100,'p1',52);
insert into products values(101,'p2',36);
insert into orders values(9001,'上海');
insert into orders values(9002,'北京');
insert into order_items values(100,9001,10);
insert into order_items values(101,9002,30);
commit;

事务执行时,发生错误

image

commit后,重新执行就ok了,很奇怪。原因还不是很清楚,猜测是上个查询事务没有提交。

你可能感兴趣的:(事务)