<?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: How to implement sleeping</title>
	<atom:link href="http://radino.eu/2008/12/25/how-to-implement-sleeping/feed/" rel="self" type="application/rss+xml" />
	<link>http://radino.eu/2008/12/25/how-to-implement-sleeping/</link>
	<description>Focusing on interesting SQL and PL/SQL problems</description>
	<lastBuildDate>Mon, 09 Apr 2012 12:20:47 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Radoslav Golian</title>
		<link>http://radino.eu/2008/12/25/how-to-implement-sleeping/comment-page-1/#comment-31</link>
		<dc:creator>Radoslav Golian</dc:creator>
		<pubDate>Fri, 08 Oct 2010 05:29:40 +0000</pubDate>
		<guid isPermaLink="false">http://radino.eu/?p=7#comment-31</guid>
		<description>Comte, see the point 4. at the beginning of this post ;)</description>
		<content:encoded><![CDATA[<p>Comte, see the point 4. at the beginning of this post <img src='http://radino.eu/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Comte</title>
		<link>http://radino.eu/2008/12/25/how-to-implement-sleeping/comment-page-1/#comment-30</link>
		<dc:creator>Comte</dc:creator>
		<pubDate>Thu, 07 Oct 2010 18:54:23 +0000</pubDate>
		<guid isPermaLink="false">http://radino.eu/?p=7#comment-30</guid>
		<description>A piece of code to implement a sleep function in PL/SQL without relying on an extern package:

create table C_SLEEP_LOCK(Un) as select 1 from dual;

create or replace procedure C_sleep(seconds in number default 1) is

   i number;

   procedure sleep_on_rowlock is
           pragma autonomous_transaction;
           tmp number;
   resource_busy exception;
   pragma exception_init (resource_busy, -30006);
   begin
        select Un into tmp from C_SLEEP_LOCK for update wait 1;
   exception
        when resource_busy then null;
   end;

begin

   savepoint sleeper_savepoint;
   select Un into i from C_SLEEP_LOCK for update;
   for i in 1..seconds loop
        sleep_on_rowlock;
   end loop;
   rollback to savepoint sleeper_savepoint;

end C_sleep;
/
You can now test:
Exec C_sleep(10);           -- 10 seconds (about) wait.

You can find the explanations there: http://blog.tanelpoder.com/2008/05/25/using-autonomous-transactions-for-sleeping/</description>
		<content:encoded><![CDATA[<p>A piece of code to implement a sleep function in PL/SQL without relying on an extern package:</p>
<p>create table C_SLEEP_LOCK(Un) as select 1 from dual;</p>
<p>create or replace procedure C_sleep(seconds in number default 1) is</p>
<p>   i number;</p>
<p>   procedure sleep_on_rowlock is<br />
           pragma autonomous_transaction;<br />
           tmp number;<br />
   resource_busy exception;<br />
   pragma exception_init (resource_busy, -30006);<br />
   begin<br />
        select Un into tmp from C_SLEEP_LOCK for update wait 1;<br />
   exception<br />
        when resource_busy then null;<br />
   end;</p>
<p>begin</p>
<p>   savepoint sleeper_savepoint;<br />
   select Un into i from C_SLEEP_LOCK for update;<br />
   for i in 1..seconds loop<br />
        sleep_on_rowlock;<br />
   end loop;<br />
   rollback to savepoint sleeper_savepoint;</p>
<p>end C_sleep;<br />
/<br />
You can now test:<br />
Exec C_sleep(10);           &#8212; 10 seconds (about) wait.</p>
<p>You can find the explanations there: <a href="http://blog.tanelpoder.com/2008/05/25/using-autonomous-transactions-for-sleeping/" rel="nofollow" onclick="pageTracker._trackPageview('/outgoing/blog.tanelpoder.com/2008/05/25/using-autonomous-transactions-for-sleeping/?referer=');">http://blog.tanelpoder.com/2008/05/25/using-autonomous-transactions-for-sleeping/</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Shayna Laski</title>
		<link>http://radino.eu/2008/12/25/how-to-implement-sleeping/comment-page-1/#comment-29</link>
		<dc:creator>Shayna Laski</dc:creator>
		<pubDate>Thu, 07 Oct 2010 00:38:14 +0000</pubDate>
		<guid isPermaLink="false">http://radino.eu/?p=7#comment-29</guid>
		<description>Nice post, thanks for posting. Now I just need to get up off the couch and actually do something... Pleasee continue this great work and I look forward to more of your great blog posts.</description>
		<content:encoded><![CDATA[<p>Nice post, thanks for posting. Now I just need to get up off the couch and actually do something&#8230; Pleasee continue this great work and I look forward to more of your great blog posts.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

