oracle中rollback的使用

----》rollback使用
SQL> create table tbl(name varchar2(10));

Table created.

SQL> insert into tbl values('zhiqiao');

1 row created.

SQL> select * from tbl;

NAME
----------
zhiqiao

SQL> delete tbl;

1 row deleted.

SQL> select * from tbl;

no rows selected

SQL> rollback;

Rollback complete.

----》没有提交(commit)的数据删除后无法rollback
SQL> select * from tbl;

no rows selected

SQL> insert into tbl values('zhiqiao');

1 row created.

SQL> select * from tbl;

NAME
----------
zhiqiao

SQL> commit;

Commit complete.

SQL> delete tbl;

1 row deleted.

SQL> select * from tbl;

no rows selected

SQL> rollback;

Rollback complete.

----》提交(commit)了的数据删除后可以使用rollback恢复
SQL> select * from tbl;

NAME
----------
zhiqiao

SQL> delete tbl;

1 row deleted.

SQL> commit;

Commit complete.

SQL> rollback;

Rollback complete.

----》删除数据后提交(commit)则无法使用rollback恢复
SQL> select * from tbl;

no rows selected

你可能感兴趣的:(数据库,oracle,sql)