rollback.md 582 字节
Newer Older
M
Mars Liu 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 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 ;
```