diff --git "a/data/2.OceanBase\344\270\255\351\230\266/9.\345\233\236\346\273\232\344\272\213\345\212\241/config.json" "b/data/2.OceanBase\344\270\255\351\230\266/9.\345\233\236\346\273\232\344\272\213\345\212\241/config.json" index df97ef0fe3486afaedaafb513366afc9f2cb7a8c..9f46a2366b25e0d0ebca616b57638d18c78ff0ff 100644 --- "a/data/2.OceanBase\344\270\255\351\230\266/9.\345\233\236\346\273\232\344\272\213\345\212\241/config.json" +++ "b/data/2.OceanBase\344\270\255\351\230\266/9.\345\233\236\346\273\232\344\272\213\345\212\241/config.json" @@ -1,5 +1,6 @@ { "keywords": [], "node_id": "oceanbase-173dda0ef67d4d178b9454191b8a2c7e", - "title": "回滚事务" + "title": "回滚事务", + "export": ["rollback.md"] } \ No newline at end of file diff --git "a/data/2.OceanBase\344\270\255\351\230\266/9.\345\233\236\346\273\232\344\272\213\345\212\241/rollback.json" "b/data/2.OceanBase\344\270\255\351\230\266/9.\345\233\236\346\273\232\344\272\213\345\212\241/rollback.json" new file mode 100644 index 0000000000000000000000000000000000000000..78186a91cf8e35ba283d822fb6f5edfdf6ee3df6 --- /dev/null +++ "b/data/2.OceanBase\344\270\255\351\230\266/9.\345\233\236\346\273\232\344\272\213\345\212\241/rollback.json" @@ -0,0 +1,5 @@ +{ + "type": "code_options", + "author": "刘鑫", + "source": "rollback.md" +} \ No newline at end of file diff --git "a/data/2.OceanBase\344\270\255\351\230\266/9.\345\233\236\346\273\232\344\272\213\345\212\241/rollback.md" "b/data/2.OceanBase\344\270\255\351\230\266/9.\345\233\236\346\273\232\344\272\213\345\212\241/rollback.md" new file mode 100644 index 0000000000000000000000000000000000000000..909447ba6bc5d5a15369046e854bb16cec581023 --- /dev/null +++ "b/data/2.OceanBase\344\270\255\351\230\266/9.\345\233\236\346\273\232\344\272\213\345\212\241/rollback.md" @@ -0,0 +1,38 @@ +# Rollback + +下列哪一个选项可以正确的回滚写入? + +## 答案 + +```sql +begin; +insert into cust(c_city, c_first, c_last) select 'Tian Jin', 'Mars', 'Liu'; +rollback ; +``` + +## 选项 + +### 先 commit 了 + +```sql +begin; +insert into cust(c_city, c_first, c_last) select 'Tian Jin', 'Mars', 'Liu'; +commit; +rollback ; +``` + +### 不必要的 end + +```sql +begin; +insert into cust(c_city, c_first, c_last) select 'Tian Jin', 'Mars', 'Liu'; +rollback ; +end; +``` + +### 没有发起事务 + +```sql +insert into cust(c_city, c_first, c_last) select 'Tian Jin', 'Mars', 'Liu'; +rollback ; +```