postgresql 事物

sql如下:

select * from taf_install where ins_no = 'AZ0012018071100068';

BEGIN TRANSACTION;--or BEGIN;开启事物

DELETE from taf_install where ins_no = 'AZ0012018071100068';

select * from taf_install where ins_no = 'AZ0012018071100068';

ROLLBACK;--回滚事物

COMMIT;--or END TRANSACTION;结束事物


步骤如下:


1.查询结果 ->

postgresql 事物

2.开始事物

postgresql 事物

3.执行删除语句

postgresql 事物

postgresql 事物

4.回滚事物,查询 结果存在

postgresql 事物

5.提交事物 查存 结果不存在

postgresql 事物