<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: Why Doesn&#8217;t this Trigger Code Work?</title>
	<atom:link href="http://hoopercharles.wordpress.com/2010/03/04/why-doesnt-this-trigger-code-work/feed/" rel="self" type="application/rss+xml" />
	<link>http://hoopercharles.wordpress.com/2010/03/04/why-doesnt-this-trigger-code-work/</link>
	<description>Miscellaneous Random Oracle Topics: Stop, Think, ... Understand</description>
	<lastBuildDate>Mon, 13 May 2013 14:10:06 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: Charles Hooper</title>
		<link>http://hoopercharles.wordpress.com/2010/03/04/why-doesnt-this-trigger-code-work/#comment-458</link>
		<dc:creator><![CDATA[Charles Hooper]]></dc:creator>
		<pubDate>Thu, 04 Mar 2010 20:27:19 +0000</pubDate>
		<guid isPermaLink="false">http://hoopercharles.wordpress.com/?p=1577#comment-458</guid>
		<description><![CDATA[Jametong and Timur, thanks for leaving dropping by to leave your comments.

The one line that I removed from my cleaned up version of the trigger code before posting it here was:
&lt;pre&gt;
PRAGMA AUTONOMOUS_TRANSACTION;
&lt;/pre&gt;

What I did not mention, at least not directly, is that the ERP system already had a before update trigger, an after update trigger, and a row level after update trigger on the OPERATION table.  At least in Oracle 10.2.0.x it is not possible to control the order in which the triggers fire (two row level triggers on the same table, for instance) so there is always a chance that the STATUS column might be updated in the other row level after the new trigger fired - and that might cause missing emails.  The possibility of potentially lost emails was something that I considered before answering the email request.

Timur, your suggestion reminded me of something that I suggested to the author of the email roughly a year ago (but did not think about until I saw your comment) - the event should be logged to another table, and then a scheduled report of some sort (I was thinking of something not scheduled with DBMS_SCHEDULER, but instead a separate program like my Report Server program) to be run against the other table.  I believe at that time I suggested the logging approach based on something that I read that was authored by Tom Kyte.  If I recall correctly, he was writing about the reasons why you would not write to an operating system file as a means of logging that an event happened - so that if a deadlock happened after that point the text file was written to, or an automatic transaction rollback and restart was preformed (I believe that Tom mentioned this possibility in his most recent book) the log file did not show that the event was successful when it was not, or show that it was successful twice when in fact it only completed once.]]></description>
		<content:encoded><![CDATA[<p>Jametong and Timur, thanks for leaving dropping by to leave your comments.</p>
<p>The one line that I removed from my cleaned up version of the trigger code before posting it here was:</p>
<pre>
PRAGMA AUTONOMOUS_TRANSACTION;
</pre>
<p>What I did not mention, at least not directly, is that the ERP system already had a before update trigger, an after update trigger, and a row level after update trigger on the OPERATION table.  At least in Oracle 10.2.0.x it is not possible to control the order in which the triggers fire (two row level triggers on the same table, for instance) so there is always a chance that the STATUS column might be updated in the other row level after the new trigger fired &#8211; and that might cause missing emails.  The possibility of potentially lost emails was something that I considered before answering the email request.</p>
<p>Timur, your suggestion reminded me of something that I suggested to the author of the email roughly a year ago (but did not think about until I saw your comment) &#8211; the event should be logged to another table, and then a scheduled report of some sort (I was thinking of something not scheduled with DBMS_SCHEDULER, but instead a separate program like my Report Server program) to be run against the other table.  I believe at that time I suggested the logging approach based on something that I read that was authored by Tom Kyte.  If I recall correctly, he was writing about the reasons why you would not write to an operating system file as a means of logging that an event happened &#8211; so that if a deadlock happened after that point the text file was written to, or an automatic transaction rollback and restart was preformed (I believe that Tom mentioned this possibility in his most recent book) the log file did not show that the event was successful when it was not, or show that it was successful twice when in fact it only completed once.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Timur Akhmadeev</title>
		<link>http://hoopercharles.wordpress.com/2010/03/04/why-doesnt-this-trigger-code-work/#comment-457</link>
		<dc:creator><![CDATA[Timur Akhmadeev]]></dc:creator>
		<pubDate>Thu, 04 Mar 2010 08:47:01 +0000</pubDate>
		<guid isPermaLink="false">http://hoopercharles.wordpress.com/?p=1577#comment-457</guid>
		<description><![CDATA[&gt;What needs to be done to finish fixing this trigger? 
Remove all code from the trigger to the job (dbms_job or dbms_scheduler).
Sending an e-mail from a trigger is not the thing to do since the AFTER UPDATE row trigger is subject to multiple calls due to statement restarts.]]></description>
		<content:encoded><![CDATA[<p>&gt;What needs to be done to finish fixing this trigger?<br />
Remove all code from the trigger to the job (dbms_job or dbms_scheduler).<br />
Sending an e-mail from a trigger is not the thing to do since the AFTER UPDATE row trigger is subject to multiple calls due to statement restarts.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jametong</title>
		<link>http://hoopercharles.wordpress.com/2010/03/04/why-doesnt-this-trigger-code-work/#comment-456</link>
		<dc:creator><![CDATA[jametong]]></dc:creator>
		<pubDate>Thu, 04 Mar 2010 06:58:06 +0000</pubDate>
		<guid isPermaLink="false">http://hoopercharles.wordpress.com/?p=1577#comment-456</guid>
		<description><![CDATA[the trigger on operation table can not query/update operation table ..

the only way to go is use autonomous_transaction.. But is this a suitable place for autonomous_transaction?]]></description>
		<content:encoded><![CDATA[<p>the trigger on operation table can not query/update operation table ..</p>
<p>the only way to go is use autonomous_transaction.. But is this a suitable place for autonomous_transaction?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
