<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>

<channel>
	<title>Oracle Tips &#187; Oracle Faq</title>
	<atom:link href="http://www.expertsharing.com/category/oracle-faq/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.expertsharing.com</link>
	<description></description>
	<pubDate>Thu, 25 Sep 2008 17:29:46 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.1</generator>
	<language>en</language>
			<item>
		<title>Differences between Delete, Drop and Truncate Statements</title>
		<link>http://www.expertsharing.com/2008/05/10/differences-between-delete-drop-and-truncate-statements/</link>
		<comments>http://www.expertsharing.com/2008/05/10/differences-between-delete-drop-and-truncate-statements/#comments</comments>
		<pubDate>Sat, 10 May 2008 17:02:56 +0000</pubDate>
		<dc:creator>Praveen</dc:creator>
		
		<category><![CDATA[Oracle Faq]]></category>

		<category><![CDATA[delete and drop oracle differences]]></category>

		<category><![CDATA[delete and truncate oracle]]></category>

		<category><![CDATA[Drop and truncate]]></category>

		<guid isPermaLink="false">http://www.expertsharing.com/2008/05/10/differences-between-delete-drop-and-truncate-statements/</guid>
		<description><![CDATA[The first difference between
delete, drop and truncate
statements is the statement nature itself. DELETE statement is a DML (DATA MANIPULATION LANGUAGE) statement. DROP AND truncate statements are DDL ( DATA definition language) statements.
A DML action can be rolledback if the data is not committed. Whereas all the DDL actions cannot be rolled back until Oracle 9i. [...]]]></description>
			<content:encoded><![CDATA[<p>The first difference between</p>
<h3>delete, drop and truncate</h3>
<p>statements is the statement nature itself. <strong>DELETE</strong> statement is a DML (DATA MANIPULATION LANGUAGE) statement. <strong>DROP AND truncate </strong>statements are DDL ( DATA definition language) statements.</p>
<p>A DML action can be rolledback if the data is not committed. Whereas all the DDL actions cannot be rolled back until Oracle 9i. But with <strong>Oracle 9i FLASH BACK </strong>enabled even some of the DDL statements can be rolledback.</p>
<p><strong>Delete</strong> : A delete statement deletes the data from a table. A delete statement can have  a where clause, on which it deletes the records that satisfy only the <em>&#8220;where&#8221;</em> condition. If the <em><br />
&#8220;where&#8221;</em> condition is omitted the delete statement deletes all the records in a table.</p>
<p><strong>Actions of Delete statement </strong>:</p>
<ul>
<li>deletes the data from the current table space</li>
<li>Modifies the undo tablespace with the delete records.</li>
<li>Executes all the before / after statement and row level triggers.</li>
<li>Updates the indexes (makes the index empty if the where clause is omitted).</li>
<li>Constraint checks are performed before deleting the rows</li>
</ul>
<p>.<span id="more-82"></span></p>
<p>Syntax of a delete Statement:</p>
<p><strong><span style="font-family: Verdana; font-size: x-small;">DELETE FROM table [WHERE condition]</span></strong></p>
<p><strong>Truncate : </strong>Truncate drops all the records in a table . But as it is a DDL statement data cannot be retrieved. Usually truncate is faster than delete statement becuase there is no need to change or update the UNDO tablespace with the deleted records. Truncate is an implict commit Statement.Truncate statement deallocates the space.</p>
<p><strong>Actions of Truncate Statement:</strong>Removes all the records from the current tablespace.</p>
<ul>
<li>Updates the indexes.</li>
<li>High watermark of the truncated table is reset.</li>
<li>Integrity Constraint checks are performed</li>
</ul>
<p>Syntax of a Truncate Statement:</p>
<p><strong><span style="font-family: Verdana; font-size: x-small;">TRUNCATE TABLE table_NAME ;</span></strong></p>
<p><strong><span style="font-family: Verdana; font-size: x-small;">DROP STATEMENT :</span></strong></p>
<p><span>A drop statements removes the  table object from the database. Structure and the data will be removed from the database. Action cannot be rolledback (but only by FLASH BACK from Oracle 9i).</span></p>
<p><strong>Actions of a Drop Statement:</strong></p>
<ul>
<li>Constraint checks are performed before dropping.</li>
<li>All the data and structure of the table will be removed.</li>
<li>Updates the corresponding data dictionary views like dba_objects, dba_tables, user_tables e.t.c</li>
<li>Updates the Status as &#8220;INVALID&#8221; for all the dependent objects.</li>
<li>Deallocates the Space</li>
<p>.</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.expertsharing.com/2008/05/10/differences-between-delete-drop-and-truncate-statements/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
