ITPub博客

首页 > 数据库 > Oracle > Diffrence Between delete and truncate

Diffrence Between delete and truncate

原创 Oracle 作者:chlf2008 时间:2011-02-19 10:52:15 0 删除 编辑

SQL> select * from T2;

I2
----------
1
2

SQL> we discuss the diffrence betwween delete and truncate;

SQL> delete from t2;

2 rows deleted.

SQL> select * from T2;

no rows selected

SQL> rollback
2 ;

Rollback complete.

SQL> select * from T2;

I2
----------
1
2

SQL> we delete the data from table,we can rollback,and the data deleted will back;

SQL>
SQL> select * from T2;

I2
----------
1
2

SQL> truncate table t2;

Table truncated.

SQL> select * from T2;

no rows selected

SQL> rollback;

Rollback complete.

SQL> select * from T2;

no rows selected

SQL> we truncate a table,the data will be found never!

SQL> delete is a DML ,but truncate is a DDL;

[@more@]

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/12262773/viewspace-1046211/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
  • 博文量
    6
  • 访问量
    6083