<?xml version="1.0" encoding="utf-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: NVL, ISNULL, IFNULL and COALESCE</title>
	<atom:link href="http://joseph.randomnetworks.com/archives/2006/03/15/nvl-isnull-ifnull-and-coalesce/feed/" rel="self" type="application/rss+xml" />
	<link>http://joseph.randomnetworks.com/archives/2006/03/15/nvl-isnull-ifnull-and-coalesce/</link>
	<description>cat /dev/random</description>
	<lastBuildDate>Sat, 04 Jul 2009 08:07:38 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9-rare</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Thorsten Kettner</title>
		<link>http://joseph.randomnetworks.com/archives/2006/03/15/nvl-isnull-ifnull-and-coalesce/comment-page-1/#comment-144960</link>
		<dc:creator>Thorsten Kettner</dc:creator>
		<pubDate>Tue, 20 Mar 2007 12:20:18 +0000</pubDate>
		<guid isPermaLink="false">http://joseph.randomnetworks.com/archives/2006/03/15/nvl-isnull-ifnull-and-coalesce/#comment-144960</guid>
		<description>Alistair, you are confusing DECODE and COALESCE. What you describe is the DECODE function. COALESCE works in Oracle as in other dbms. It takes the first value from the list which is not null. Hence giving it two args only equals NVL.

Thorsten.</description>
		<content:encoded><![CDATA[<p>Alistair, you are confusing DECODE and COALESCE. What you describe is the DECODE function. COALESCE works in Oracle as in other dbms. It takes the first value from the list which is not null. Hence giving it two args only equals NVL.</p>
<p>Thorsten.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alistair</title>
		<link>http://joseph.randomnetworks.com/archives/2006/03/15/nvl-isnull-ifnull-and-coalesce/comment-page-1/#comment-123061</link>
		<dc:creator>Alistair</dc:creator>
		<pubDate>Thu, 22 Feb 2007 13:06:18 +0000</pubDate>
		<guid isPermaLink="false">http://joseph.randomnetworks.com/archives/2006/03/15/nvl-isnull-ifnull-and-coalesce/#comment-123061</guid>
		<description>Joseph,

I&#039;m not sure if you&#039;re aware or not but there is a difference between an NVL and a COALESCE in Oracle. Using an NVL, you check a single field and replace a NULL value with your preferred replacement, for example:

&lt;code&gt;SELECT NVL(dog, &#039;cat&#039;) FROM Animals;&lt;/code&gt;

In which case, if the dog column contained a NULL value the value of &#039;cat&#039; would be substituted in.

A COALESCE is essentially an inline if-then-elsif-else block. The COALESCE function can accept any number of values and do the replacement, for example:

&lt;code&gt;SELECT COALESCE(dog, &#039;foxy&#039;, &#039;energetic&#039;, &#039;poodle&#039;, &#039;happy&#039;, &#039;cats win&#039;) FROM  Animal;&lt;/code&gt;

In the above example, if the value of the dog column is &#039;foxy&#039;, then &#039;energetic&#039; will be substituted in; likewise for &#039;poodle&#039; and &#039;happy&#039;. If it isn&#039;t either of those values though, then &#039;cats win&#039; will be substituted in.

Regards,
Al.</description>
		<content:encoded><![CDATA[<p>Joseph,</p>
<p>I&#8217;m not sure if you&#8217;re aware or not but there is a difference between an NVL and a COALESCE in Oracle. Using an NVL, you check a single field and replace a NULL value with your preferred replacement, for example:</p>
<p><code>SELECT NVL(dog, 'cat') FROM Animals;</code></p>
<p>In which case, if the dog column contained a NULL value the value of &#8216;cat&#8217; would be substituted in.</p>
<p>A COALESCE is essentially an inline if-then-elsif-else block. The COALESCE function can accept any number of values and do the replacement, for example:</p>
<p><code>SELECT COALESCE(dog, 'foxy', 'energetic', 'poodle', 'happy', 'cats win') FROM  Animal;</code></p>
<p>In the above example, if the value of the dog column is &#8216;foxy&#8217;, then &#8216;energetic&#8217; will be substituted in; likewise for &#8216;poodle&#8217; and &#8216;happy&#8217;. If it isn&#8217;t either of those values though, then &#8216;cats win&#8217; will be substituted in.</p>
<p>Regards,<br />
Al.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Richard Tallent</title>
		<link>http://joseph.randomnetworks.com/archives/2006/03/15/nvl-isnull-ifnull-and-coalesce/comment-page-1/#comment-84843</link>
		<dc:creator>Richard Tallent</dc:creator>
		<pubDate>Thu, 28 Dec 2006 19:08:42 +0000</pubDate>
		<guid isPermaLink="false">http://joseph.randomnetworks.com/archives/2006/03/15/nvl-isnull-ifnull-and-coalesce/#comment-84843</guid>
		<description>In SQL Server, COALESCE() can result in a sub-optimal execution plan, so ISNULL() is better if you only need to test one value for NULL. There are some other differences as well (more info at http://databases.aspfaq.com/database/coalesce-vs-isnull-sql.html)</description>
		<content:encoded><![CDATA[<p>In SQL Server, COALESCE() can result in a sub-optimal execution plan, so ISNULL() is better if you only need to test one value for NULL. There are some other differences as well (more info at <a href="http://databases.aspfaq.com/database/coalesce-vs-isnull-sql.html" rel="nofollow">http://databases.aspfaq.com/database/coalesce-vs-isnull-sql.html</a>)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jason</title>
		<link>http://joseph.randomnetworks.com/archives/2006/03/15/nvl-isnull-ifnull-and-coalesce/comment-page-1/#comment-62280</link>
		<dc:creator>Jason</dc:creator>
		<pubDate>Sun, 05 Nov 2006 01:15:54 +0000</pubDate>
		<guid isPermaLink="false">http://joseph.randomnetworks.com/archives/2006/03/15/nvl-isnull-ifnull-and-coalesce/#comment-62280</guid>
		<description>Good notes. DB2 also uses Coalesce.</description>
		<content:encoded><![CDATA[<p>Good notes. DB2 also uses Coalesce.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Raimond Verwei</title>
		<link>http://joseph.randomnetworks.com/archives/2006/03/15/nvl-isnull-ifnull-and-coalesce/comment-page-1/#comment-14187</link>
		<dc:creator>Raimond Verwei</dc:creator>
		<pubDate>Wed, 24 May 2006 07:26:53 +0000</pubDate>
		<guid isPermaLink="false">http://joseph.randomnetworks.com/archives/2006/03/15/nvl-isnull-ifnull-and-coalesce/#comment-14187</guid>
		<description>DB2 also supports COALESCE(...)
You might want to add that to the list.</description>
		<content:encoded><![CDATA[<p>DB2 also supports COALESCE(&#8230;)<br />
You might want to add that to the list.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
