From 239a6a42fd70b52a960b140dae38590f3c01cf60 Mon Sep 17 00:00:00 2001 From: Mars Liu Date: Thu, 4 Nov 2021 18:30:47 +0800 Subject: [PATCH] rollback --- .../config.json" | 3 +- .../rollback.json" | 5 +++ .../rollback.md" | 38 +++++++++++++++++++ 3 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 "data/2.OceanBase\344\270\255\351\230\266/9.\345\233\236\346\273\232\344\272\213\345\212\241/rollback.json" create mode 100644 "data/2.OceanBase\344\270\255\351\230\266/9.\345\233\236\346\273\232\344\272\213\345\212\241/rollback.md" 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 df97ef0..9f46a23 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 0000000..78186a9 --- /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 0000000..909447b --- /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 ; +``` -- GitLab