<?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"
	>
<channel>
	<title>Comments on: MERGE syntax</title>
	<atom:link href="http://laurentschneider.com/wordpress/2007/05/merge-syntax.html/feed/" rel="self" type="application/rss+xml" />
	<link>http://laurentschneider.com/wordpress/2007/05/merge-syntax.html</link>
	<description>Oracle Certified Master</description>
	<pubDate>Mon, 01 Dec 2008 20:13:34 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.5</generator>
		<item>
		<title>By: Laurent Schneider</title>
		<link>http://laurentschneider.com/wordpress/2007/05/merge-syntax.html#comment-4663</link>
		<dc:creator>Laurent Schneider</dc:creator>
		<pubDate>Thu, 06 Sep 2007 08:05:54 +0000</pubDate>
		<guid isPermaLink="false">http://laurentschneider.com/wordpress/2007/05/merge-syntax.html#comment-4663</guid>
		<description>exp/imp? or truncate than insert as select?</description>
		<content:encoded><![CDATA[<p>exp/imp? or truncate than insert as select?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hal Armstrong</title>
		<link>http://laurentschneider.com/wordpress/2007/05/merge-syntax.html#comment-4660</link>
		<dc:creator>Hal Armstrong</dc:creator>
		<pubDate>Wed, 05 Sep 2007 21:56:49 +0000</pubDate>
		<guid isPermaLink="false">http://laurentschneider.com/wordpress/2007/05/merge-syntax.html#comment-4660</guid>
		<description>I have issues where I have several development databases and some are up to date and some are behind.  Merge can be used to write scripts to "Force this data, whether by INSERT or UPDATE".

Example:
MERGE INTO po_discount_reason dest
USING (SELECT 40 AS PO_DISCOUNT_REASON_CD FROM dual) sou
ON (sou.PO_DISCOUNT_REASON_CD = dest.PO_DISCOUNT_REASON_CD)
WHEN MATCHED THEN
   UPDATE SET
      rank = 40,
      name = 'Temporary Discount',
      description = 'Temporary Discount'
WHEN NOT MATCHED THEN
  INSERT (
    po_discount_reason_cd, rank, name, description )
  VALUES (
    40, 40, 'Temporary Discount', 'Temporary Discount');

The above works.  Is there any simpler way to do the same?</description>
		<content:encoded><![CDATA[<p>I have issues where I have several development databases and some are up to date and some are behind.  Merge can be used to write scripts to &#8220;Force this data, whether by INSERT or UPDATE&#8221;.</p>
<p>Example:<br />
MERGE INTO po_discount_reason dest<br />
USING (SELECT 40 AS PO_DISCOUNT_REASON_CD FROM dual) sou<br />
ON (sou.PO_DISCOUNT_REASON_CD = dest.PO_DISCOUNT_REASON_CD)<br />
WHEN MATCHED THEN<br />
   UPDATE SET<br />
      rank = 40,<br />
      name = &#8216;Temporary Discount&#8217;,<br />
      description = &#8216;Temporary Discount&#8217;<br />
WHEN NOT MATCHED THEN<br />
  INSERT (<br />
    po_discount_reason_cd, rank, name, description )<br />
  VALUES (<br />
    40, 40, &#8216;Temporary Discount&#8217;, &#8216;Temporary Discount&#8217;);</p>
<p>The above works.  Is there any simpler way to do the same?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Laurent Schneider</title>
		<link>http://laurentschneider.com/wordpress/2007/05/merge-syntax.html#comment-2499</link>
		<dc:creator>Laurent Schneider</dc:creator>
		<pubDate>Tue, 15 May 2007 10:39:55 +0000</pubDate>
		<guid isPermaLink="false">http://laurentschneider.com/wordpress/2007/05/merge-syntax.html#comment-2499</guid>
		<description>&lt;i&gt; merge into t1 using t2 on (t1.id=t2.id)
when matched then
  update set name=t2.name;
&lt;/i&gt;

to update only the rows that have changed, I add a where clause
&lt;code&gt;
merge into t1 using t2 on (t1.id=t2.id)
when matched then
  update set name=t2.name
  where lnnvl(name=t2.name);
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p><i> merge into t1 using t2 on (t1.id=t2.id)<br />
when matched then<br />
  update set name=t2.name;<br />
</i></p>
<p>to update only the rows that have changed, I add a where clause<br />
<pre><code>
merge into t1 using t2 on (t1.id=t2.id)
when matched then
&nbsp;&nbsp;update set name=t2.name
&nbsp;&nbsp;where lnnvl(name=t2.name);
</code></pre></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Laurent Schneider</title>
		<link>http://laurentschneider.com/wordpress/2007/05/merge-syntax.html#comment-2495</link>
		<dc:creator>Laurent Schneider</dc:creator>
		<pubDate>Mon, 14 May 2007 18:12:47 +0000</pubDate>
		<guid isPermaLink="false">http://laurentschneider.com/wordpress/2007/05/merge-syntax.html#comment-2495</guid>
		<description>well, the can only delete when matched, I would be more interested in deleting &lt;i&gt;&#60;2;ORANGE&#62; &lt;/i&gt; or betting updating &lt;i&gt;&#60;2;ORANGE&#62;&lt;/i&gt; to &lt;i&gt;&#60;2;ORANGE;deleted&#62;&lt;/i&gt; 

thanks for the comments</description>
		<content:encoded><![CDATA[<p>well, the can only delete when matched, I would be more interested in deleting <i>&lt;2;ORANGE&gt; </i> or betting updating <i>&lt;2;ORANGE&gt;</i> to <i>&lt;2;ORANGE;deleted&gt;</i> </p>
<p>thanks for the comments</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeff Moss</title>
		<link>http://laurentschneider.com/wordpress/2007/05/merge-syntax.html#comment-2494</link>
		<dc:creator>Jeff Moss</dc:creator>
		<pubDate>Mon, 14 May 2007 17:58:41 +0000</pubDate>
		<guid isPermaLink="false">http://laurentschneider.com/wordpress/2007/05/merge-syntax.html#comment-2494</guid>
		<description>...can also do DELETE operations too...as I'm sure you're aware Laurent.

http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_9016.htm#i2081030</description>
		<content:encoded><![CDATA[<p>&#8230;can also do DELETE operations too&#8230;as I&#8217;m sure you&#8217;re aware Laurent.</p>
<p><a href="http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_9016.htm#i2081030" rel="nofollow">http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_9016.htm#i2081030</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: vidya</title>
		<link>http://laurentschneider.com/wordpress/2007/05/merge-syntax.html#comment-2493</link>
		<dc:creator>vidya</dc:creator>
		<pubDate>Mon, 14 May 2007 16:58:55 +0000</pubDate>
		<guid isPermaLink="false">http://laurentschneider.com/wordpress/2007/05/merge-syntax.html#comment-2493</guid>
		<description>Thanks Laurent ...intuitive and extremely useful (both for db and ETL developers)</description>
		<content:encoded><![CDATA[<p>Thanks Laurent &#8230;intuitive and extremely useful (both for db and ETL developers)</p>
]]></content:encoded>
	</item>
</channel>
</rss>
