<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.3.3" -->
<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/"
	>

<channel>
	<title>Database Innovations</title>
	<link>http://db-innovations.co.uk/wordpress</link>
	<description>The thoughts and ramblings of an old Oracle veteran</description>
	<pubDate>Thu, 16 Sep 2010 21:49:27 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.3</generator>
	<language>en</language>
			<item>
		<title>The hidden side effects of the MERGE command</title>
		<link>http://db-innovations.co.uk/wordpress/?p=5</link>
		<comments>http://db-innovations.co.uk/wordpress/?p=5#comments</comments>
		<pubDate>Thu, 16 Sep 2010 21:49:27 +0000</pubDate>
		<dc:creator>phil</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://db-innovations.co.uk/wordpress/?p=5</guid>
		<description><![CDATA[The MERGE statement in Oracle is proving to be a very useful command, particularly if you have to perform a series of INSERTs and UPDATEs based on a fairly complicated or long winded piece of SQL. Oracle 10g also introduced a means of performing a DELETE. But are you aware of some of the side [...]]]></description>
			<content:encoded><![CDATA[<p>The MERGE statement in Oracle is proving to be a very useful command, particularly if you have to perform a series of INSERTs and UPDATEs based on a fairly complicated or long winded piece of SQL. Oracle 10g also introduced a means of performing a DELETE. But are you aware of some of the side effects&#8230;</p>
<p>If you are merging into a table that has statement level triggers, then both the INSERT and UPDATE triggers will fire. If the merge statement also caters for a DELETE, then the DELETE trigger will fire too. If you have a single trigger for all operations combined, then it will fire the trigger for each operation covered. So even if your MERGE statement only ends up doing one operation, the trigger will still fire for all possible operations.</p>
<p>The DELETE operation is not an option in its own right. It is an alternative outcome for an UPDATE, i.e. if a particular condition is met, then perform a DELETE instead of an UPDATE. If you don&#8217;t want to perform an update (e.g. your MERGE only performs INSERTs or DELETEs), then you must specifiy a dummy update in the SET clause, which must be based on a non-primary key column (or matching column for the MERGE). The resultant effect of this is that the ROW LEVEL UPDATE trigger always fires even for DELETEs.</p>
<p>So the MERGE statement can cause an awful lot of unnecessary trigger firing. A nice to have for statement level triggers is the ability to support a fourth operation for a MERGE or some other generic operation - which is affectively saying &#8220;I don&#8217;t care what operation the statement is performing, just run this trigger code once for the statement&#8221;.</p>
<p>A another nice to have with the MERGE statement is knowing how many rows were affected by each operation. The SQL%ROWCOUNT cursor attribute will not distinguish between the operations and only reports a total number of rows. So why not have a SQL%UPATECOUNT, SQL%DELETECOUNT, etc. This could be further extended when used with the FORALL in PL/SQL with the psueo array SQL%BULK_ROWCOUNT(index).</p>
]]></content:encoded>
			<wfw:commentRss>http://db-innovations.co.uk/wordpress/?feed=rss2&amp;p=5</wfw:commentRss>
		</item>
		<item>
		<title>Art and Form</title>
		<link>http://db-innovations.co.uk/wordpress/?p=4</link>
		<comments>http://db-innovations.co.uk/wordpress/?p=4#comments</comments>
		<pubDate>Sun, 12 Sep 2010 13:20:26 +0000</pubDate>
		<dc:creator>phil</dc:creator>
		
		<category><![CDATA[Ramblings]]></category>

		<guid isPermaLink="false">http://db-innovations.co.uk/wordpress/?p=4</guid>
		<description><![CDATA[Does a database developer need to worry about form (in the sense of the pleasing visual aspects of a piece of work)? As database code resides in the server with very little interaction or influence on the users visable experience, then I guess most would say no. However, developers need to work on the coding efforts of others, and [...]]]></description>
			<content:encoded><![CDATA[<p>Does a database developer need to worry about form (in the sense of the pleasing visual aspects of a piece of work)? As database code resides in the server with very little interaction or influence on the users visable experience, then I guess most would say no. However, developers need to work on the coding efforts of others, and if it is not clearly layed out or visually pleasing it can be a chore to decipher and will provide zero or little inspiration. A developer is entitled to a visual pleasing experience when looking at any code, so I struggle to understand why so many new-breed database developers do not see a need to format their code with correct indentation, consistent use of upper and lower case, standard on variable naming, and so on. Is it just laziness or are the perputrators completely void of the concept of form? </p>
<p>Would it matter that a Mercedes car has beautifully formed body panels, polished to perfection, designed to be pleasing and visaually enjoyed, or could it just be beaten out of old corrugated metal and welded together - after all it is only a means of getting from A to B. And after all, code is only for executing not for visual enjoyment, isn&#8217;t it? I wouldn&#8217;t agree.</p>
<p>I have now resolved to the fact that code resembling hand beatten corrugated metal is going to be with us for a while, or until the concept of form in an artistic sense is better appreciated, and to bang on about, as I usually do, seems to be turning into a fruitless one man battle. Today&#8217;s programmer&#8217;s are tomorrow&#8217;s designers and architects, so they will need show some creativity if we don&#8217;t want the industry to be dumbed down into oblivian, and starting with the visual aspects of their code is a good starting point.</p>
]]></content:encoded>
			<wfw:commentRss>http://db-innovations.co.uk/wordpress/?feed=rss2&amp;p=4</wfw:commentRss>
		</item>
		<item>
		<title>PL/SQL Challenge</title>
		<link>http://db-innovations.co.uk/wordpress/?p=3</link>
		<comments>http://db-innovations.co.uk/wordpress/?p=3#comments</comments>
		<pubDate>Sun, 12 Sep 2010 08:10:16 +0000</pubDate>
		<dc:creator>phil</dc:creator>
		
		<category><![CDATA[Ramblings]]></category>

		<guid isPermaLink="false">http://db-innovations.co.uk/wordpress/?p=3</guid>
		<description><![CDATA[Knowledge is a very valuable asset, but if your brain is not one that absorbs hard facts too easily, then being tested on it, and nothing else, can do you no favours. Steven Feuerstein&#8217;s PL/SQL Challenge, and my pet hate - Oracle certification exams, are very good examples of knowledge tests. You would have thought a degree educated, Mensa [...]]]></description>
			<content:encoded><![CDATA[<p>Knowledge is a very valuable asset, but if your brain is not one that absorbs hard facts too easily, then being tested on it, and nothing else, can do you no favours. Steven Feuerstein&#8217;s <a href="http://www.plsqlchallenge.com" title="PL/SQL Challenge">PL/SQL Challenge</a>, and my pet hate - Oracle certification exams, are very good examples of knowledge tests. You would have thought a degree educated, Mensa member, with almost 20 years working with PL/SQL (since it was launched in Forms 3), would be riding high in the PL/SQL Challenge league table, but no. I have a brain like a sieve and my general philosophy to life is to only find out about things when I need to know them, since storage space in my brain is a scarce resource. So knowing obscure facts and behaviour of PL/SQL is not my strong point, and however hard I try I will not develop a strong enough obsession to learn all there is to know about PL/SQL and fluently regurgitate it. Thankfully I am gifted with dyslexia with its side effect of making me a holistic thinker and problem solver, which gives me an advantage over those mere mortal analytic thinker types good with facts and procedure.</p>
]]></content:encoded>
			<wfw:commentRss>http://db-innovations.co.uk/wordpress/?feed=rss2&amp;p=3</wfw:commentRss>
		</item>
		<item>
		<title>Hello world!</title>
		<link>http://db-innovations.co.uk/wordpress/?p=1</link>
		<comments>http://db-innovations.co.uk/wordpress/?p=1#comments</comments>
		<pubDate>Tue, 11 Mar 2008 05:31:12 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://ilobachev.sa.plesk.ru/wordpress/?p=1</guid>
		<description><![CDATA[Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!
]]></description>
			<content:encoded><![CDATA[<p>Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!</p>
]]></content:encoded>
			<wfw:commentRss>http://db-innovations.co.uk/wordpress/?feed=rss2&amp;p=1</wfw:commentRss>
		</item>
	</channel>
</rss>

