Difference between Truncate and Delete
858930Jul 31 2011 — edited Aug 3 2011truncate table t_function_master*
Error starting at line 4 in command:
truncate table t_function_master
Error report:
SQL Error: ORA-02266: unique/primary keys in table referenced by enabled foreign keys
02266. 00000 - "unique/primary keys in table referenced by enabled foreign keys"
*Cause: An attempt was made to truncate a table with unique or
primary keys referenced by foreign keys enabled in another table.
Other operations not allowed are dropping/truncating a partition of a
partitioned table or an ALTER TABLE EXCHANGE PARTITION.
*Action: Before performing the above operations the table, disable the
foreign key constraints in other tables. You can see what
constraints are referencing a table by issuing the following
command:
SELECT * FROM USER_CONSTRAINTS WHERE TABLE_NAME = "tabnam";
delete from t_function_master;*
19 rows deleted.
As far as i know DROP and TRUNCATE are DDL commands, whereas DELETE is a DML command. As such, DELETE operations can be rolled back (undone), while DROP and TRUNCATE operations cannot be rolled back. ( taken from website )
I didn`t know that delete will not check on constraints ?? Is this truth ?? Is there some understanding i am missing for delete statement ?