<?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"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Oracle Database Tips blog &#187; delete syntax</title>
	<atom:link href="http://oracle-database-tips.com/wp/tag/delete-syntax/feed" rel="self" type="application/rss+xml" />
	<link>http://oracle-database-tips.com/wp</link>
	<description>News for Oracle professionals</description>
	<lastBuildDate>Fri, 11 May 2012 12:12:40 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Oracle Delete syntax</title>
		<link>http://oracle-database-tips.com/wp/sql/oracle-delete-syntax</link>
		<comments>http://oracle-database-tips.com/wp/sql/oracle-delete-syntax#comments</comments>
		<pubDate>Fri, 23 Oct 2009 11:03:55 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[SQL]]></category>
		<category><![CDATA[delete syntax]]></category>
		<category><![CDATA[finance]]></category>
		<category><![CDATA[melbourne]]></category>
		<category><![CDATA[oracle delete]]></category>
		<category><![CDATA[restriction]]></category>
		<category><![CDATA[sql delete]]></category>
		<category><![CDATA[syntax]]></category>

		<guid isPermaLink="false">http://oracle-database-tips.com/wp/?p=72</guid>
		<description><![CDATA[The Oracle Delete statement allows you to remove rows from a table.]]></description>
			<content:encoded><![CDATA[<p>Always test these &#8216;oracle delete&#8217; commands on a test server<br />
before implementing them on a production server.</p>
<p>The Oracle Delete statement allows you to remove rows from a table.</p>
<p>The syntax is : delete from<br />
(where );</p>
<p>If you specify the delete statement without the where clause, you will delete all rows from a table.</p>
<p>Specifying the where clause will restrict the deletion to the rows which match the restriction clause.</p>
<p>Here is the sample table:</p>
<p>SQL&gt; select * from dept order by deptno;</p>
<p>DEPTNO DNAME          LOC<br />
&#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;&#8212;&#8211; &#8212;&#8212;&#8212;&#8212;-<br />
10 ACCOUNTING     NEW YORK<br />
20 RESEARCH       DALLAS<br />
30 SALES          CHICAGO<br />
40 OPERATIONS     BOSTON<br />
50 MARKETING      MELBOURNE<br />
60 IT             HARTORD<br />
70 CALLCENTRE<br />
80 SUPPORT        NONE<br />
90                BOISE<br />
91 SHIPPING       DETROIT<br />
92 FINANCE        DETROIT</p>
<p>11 rows selected.</p>
<p>Let&#8217;s delete all rows that are located in Detroit.</p>
<p>SQL&gt; delete from dept where loc = &#8216;DETROIT&#8217;;</p>
<p>2 rows deleted.</p>
<p>SQL&gt; select * from dept order by deptno;</p>
<p>DEPTNO DNAME          LOC<br />
&#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;&#8212;&#8211; &#8212;&#8212;&#8212;&#8212;-<br />
10 ACCOUNTING     NEW YORK<br />
20 RESEARCH       DALLAS<br />
30 SALES          CHICAGO<br />
40 OPERATIONS     BOSTON<br />
50 MARKETING      MELBOURNE<br />
60 IT             HARTORD<br />
70 CALLCENTRE<br />
80 SUPPORT        NONE<br />
90                BOISE</p>
<p>9 rows selected.</p>
<p>Now let&#8217;s select all rows that have a null value in either the dname column or the deptno column.</p>
<p>SQL&gt; delete from dept where dname is null or loc is null;</p>
<p>2 rows deleted.</p>
<p>SQL&gt; select * from dept order by deptno;</p>
<p>DEPTNO DNAME          LOC<br />
&#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;&#8212;&#8211; &#8212;&#8212;&#8212;&#8212;-<br />
10 ACCOUNTING     NEW YORK<br />
20 RESEARCH       DALLAS<br />
30 SALES          CHICAGO<br />
40 OPERATIONS     BOSTON<br />
50 MARKETING      MELBOURNE<br />
60 IT             HARTORD<br />
80 SUPPORT        NONE</p>
<p>7 rows selected.</p>
<p>Now let&#8217;s delete all the remaining rows from this table:</p>
<p>SQL&gt; delete from dept;</p>
<p>7 rows deleted.</p>
<p>SQL&gt; select * from dept order by deptno;</p>
<p>no rows selected</p>
<p>Lastly: do not forget to commit to make your changes permanent after you use the Delete statement.</p>
<p>Recommended reading:</p>
<p><a title="opens new window" onclick="window.open('http://www.oracle-database-tips.com/cgi-bin/counter.pl?url=http%3A%2F%2Fdownload.oracle.com%2Fdocs%2Fcd%2FB19306_01%2Fserver.102%2Fb14200%2Fstatements_8005.htm%23i2117787&amp;referrer=http%3A%2F%2Fwww.oracle-database-tips.com%2Foracle_delete.html'); return false;" href="http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_8005.htm#i2117787" target="_blank">Oracle Online Documentation: SQL Reference, Delete statement</a></p>
]]></content:encoded>
			<wfw:commentRss>http://oracle-database-tips.com/wp/sql/oracle-delete-syntax/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

