|
|
Re: Truncating a column [message #9271 is a reply to message #9263] |
Thu, 30 October 2003 01:00 |
|
Maaher
Messages: 7065 Registered: December 2001
|
Senior Member |
|
|
In addition to what Todd said:
A truncate just resets the High Water Mark (HWM) for a table. The HWM is the point that marks the upper boundary of a tables' data, i.e. the last block assigned to this table containing data. So when you perform a full table scan on a table, the data blocks will be read until the HWM is reached.
TRUNCATE will place the HWM in the first block assigned to the table and reset the space allocated to the initial storage parameters, without actually deleting data. The data is just 'forgotten' and won't be read since the HWM is being placed before them.
The main reason for this statement is: If you delete from a table, the High Water Mark will remain, so will the extents. So a full table scan will still pass ALL the blocks that contain or have contained (at one point in time) data. This is necessary because a database block might still contain SOME data. All the disk space allocated (extents etc.) will remain too for the same reason.
Now you might understand why the TRUNCATE statement cannot be seen as a DML operation, but it is DDL that affects an entire table.
For more info I refer to the Oracle documentation (http://tahiti.oracle.com) and AskTom (http://asktom.oracle.com). Tom Kyte is usually very clear and straight-forward in his explanation and, even more important, uses real life examples a lot.
HTH,
MHE
|
|
|
Re: Truncating a column [message #9290 is a reply to message #9265] |
Fri, 31 October 2003 06:47 |
Tony Grace
Messages: 23 Registered: August 2003
|
Junior Member |
|
|
So the only way to clear the values of the data within a particular column is through an sql statement?
what kind of sql statment would that be?
|
|
|
|