Friday, January 8, 2010

Sql Diff Diff Betwn Truncate() And Delete() In Pl/sql?

Diff betwn Truncate() and delete() in pl/sql? - sql diff

TRUNCATE

1. It DDL.
2. The speed is faster
3. No. CHECK constraints.
4. Rollback is not possible.
5. You can not, the clause

DELETE

1. It is a DDL
2. The speed is slow
3. Check whether there are any restrictions, so that the fault of the shoes.
4. You can undo.
5. If the user clause

For example:

DELETE

The Delete command is used to delete rows in a table. The WHERE clause can be used to remove only a few lines. If you do not specify a WHERE clause, all rows are deleted. After performing a DELETE operation, you have to commit or restore operation again, to make the change permanent or irreversible. Note that this is all DELETE triggers on the table on fire.

SQL> SELECT COUNT (*) FROM emp;

COUNT (*)
----------
14

SQL> DELETE FROM emp WHERE job = 'CLERK';

4 rows deleted.

SQL> commit;

Commit complete.

SQL> SELECT COUNT (*) FROM emp;

COUNT (*)
----------
10

TRUNCATE

TRUNCATE removes all rows from a table. The process is not reversible and the fire will be fired. As such Trucat is faster and does not use undo space of a job.

To focus on SQL> TRUNCATE TABLE;

Table truncated.

SQL> SELECT COUNT (*) FROM emp;

COUNT (*)
----------
0

0 comments:

Post a Comment