<?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: If you can&#8217;t do it in PL/SQL, do it in SQL</title>
	<atom:link href="http://mikesmithers.wordpress.com/2011/07/31/if-you-cant-do-it-in-plsql-do-it-in-sql/feed/" rel="self" type="application/rss+xml" />
	<link>http://mikesmithers.wordpress.com/2011/07/31/if-you-cant-do-it-in-plsql-do-it-in-sql/</link>
	<description>Oracle - for when it was like that when you got there</description>
	<lastBuildDate>Wed, 01 May 2013 11:15:26 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: Boneisteist</title>
		<link>http://mikesmithers.wordpress.com/2011/07/31/if-you-cant-do-it-in-plsql-do-it-in-sql/#comment-4903</link>
		<dc:creator><![CDATA[Boneisteist]]></dc:creator>
		<pubDate>Sat, 06 Aug 2011 11:33:24 +0000</pubDate>
		<guid isPermaLink="false">http://mikesmithers.wordpress.com/?p=1086#comment-4903</guid>
		<description><![CDATA[Tree walking is possible in (some versions of) some other rdbms&#039;s, with the advent of Common Table Expressions (at least, I think that&#039;s what they call them!), which Oracle 11g has too (only it&#039;s an advance of the Subquery-factoring we&#039;ve had for a while now!).

[sourcecode]
testing
  1
2   3
[/sourcecode]

thanks for the tip!]]></description>
		<content:encoded><![CDATA[<p>Tree walking is possible in (some versions of) some other rdbms&#8217;s, with the advent of Common Table Expressions (at least, I think that&#8217;s what they call them!), which Oracle 11g has too (only it&#8217;s an advance of the Subquery-factoring we&#8217;ve had for a while now!).</p>
<pre class="brush: plain; title: ; notranslate">
testing
  1
2   3
</pre>
<p>thanks for the tip!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mikesmithers</title>
		<link>http://mikesmithers.wordpress.com/2011/07/31/if-you-cant-do-it-in-plsql-do-it-in-sql/#comment-4899</link>
		<dc:creator><![CDATA[mikesmithers]]></dc:creator>
		<pubDate>Sat, 06 Aug 2011 10:57:36 +0000</pubDate>
		<guid isPermaLink="false">http://mikesmithers.wordpress.com/?p=1086#comment-4899</guid>
		<description><![CDATA[Boneist, 

thanks for your persistence.
Your solution is far more elegant than mine. So what if tree walking ( connect by prior etc) is proprietary to Oracle, they started it with their fancy date formats !
In any case, the Universal Translator has long given up in despair and wandered off in the direction of the pub.
Incidentally, formatting code in wordpress is possible if you use the &quot;sourcecode&quot;  &quot;/sourcecode&quot; tags. You need to enclose them in square brackets ( and I can&#039;t drop them into this comment cos it treats them as tags and you don&#039;t see them ! Yes, it took me a while to work that one out as well.]]></description>
		<content:encoded><![CDATA[<p>Boneist, </p>
<p>thanks for your persistence.<br />
Your solution is far more elegant than mine. So what if tree walking ( connect by prior etc) is proprietary to Oracle, they started it with their fancy date formats !<br />
In any case, the Universal Translator has long given up in despair and wandered off in the direction of the pub.<br />
Incidentally, formatting code in wordpress is possible if you use the &#8220;sourcecode&#8221;  &#8220;/sourcecode&#8221; tags. You need to enclose them in square brackets ( and I can&#8217;t drop them into this comment cos it treats them as tags and you don&#8217;t see them ! Yes, it took me a while to work that one out as well.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Boneist</title>
		<link>http://mikesmithers.wordpress.com/2011/07/31/if-you-cant-do-it-in-plsql-do-it-in-sql/#comment-4597</link>
		<dc:creator><![CDATA[Boneist]]></dc:creator>
		<pubDate>Thu, 04 Aug 2011 14:26:09 +0000</pubDate>
		<guid isPermaLink="false">http://mikesmithers.wordpress.com/?p=1086#comment-4597</guid>
		<description><![CDATA[ah, I worked it out, it was the &gt; sign which was confusing Wordpress.

Last attempt at getting the right sql (if it doesn&#039;t change the &amp;&gt; into a greater than sign, please replace manually before running!):

&lt;pre&gt;
with dates as (select trunc(sysdate, &#039;mm&#039;) + 21 + level dt -- 23rd of the month and onwards
               from   dual
               connect by level &lt;= 5
               union
               select last_day(trunc(sysdate)) + level dt -- 1st of next month and onwards
               from   dual
               connect by level &lt;= 5)
select min(dt), min(case when dt &gt; last_day(trunc(sysdate)) then dt end)
from   dates
where  to_char(dt, &#039;DY&#039;, &#039;nls_date_language=english&#039;) not in (&#039;SAT&#039;, &#039;SUN&#039;)
and    dt not in (select bh_date from bank_holidays);
&lt;/pre&gt;

I wish there was a preview on comments available!]]></description>
		<content:encoded><![CDATA[<p>ah, I worked it out, it was the &gt; sign which was confusing WordPress.</p>
<p>Last attempt at getting the right sql (if it doesn&#8217;t change the &amp;&amp;gt; into a greater than sign, please replace manually before running!):</p>
<pre>
with dates as (select trunc(sysdate, 'mm') + 21 + level dt -- 23rd of the month and onwards
               from   dual
               connect by level &lt;= 5
               union
               select last_day(trunc(sysdate)) + level dt -- 1st of next month and onwards
               from   dual
               connect by level &lt;= 5)
select min(dt), min(case when dt &gt; last_day(trunc(sysdate)) then dt end)
from   dates
where  to_char(dt, &#039;DY&#039;, &#039;nls_date_language=english&#039;) not in (&#039;SAT&#039;, &#039;SUN&#039;)
and    dt not in (select bh_date from bank_holidays);
</pre>
<p>I wish there was a preview on comments available!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Boneist</title>
		<link>http://mikesmithers.wordpress.com/2011/07/31/if-you-cant-do-it-in-plsql-do-it-in-sql/#comment-4596</link>
		<dc:creator><![CDATA[Boneist]]></dc:creator>
		<pubDate>Thu, 04 Aug 2011 14:22:11 +0000</pubDate>
		<guid isPermaLink="false">http://mikesmithers.wordpress.com/?p=1086#comment-4596</guid>
		<description><![CDATA[I think I&#039;m going to give up; clearly I can&#039;t master the art of C&amp;P!

This is hopefully the correct version, using sysdate etc:

&lt;pre&gt;
with dates as (select trunc(sysdate, &#039;mm&#039;) + 21 + level dt -- 23rd of the month and onwards
               from   dual
               connect by level &lt;= 5
               union
               select last_day(trunc(sysdate)) + level dt -- 1st of next month and onwards
               from   dual
               connect by level  last_day(trunc(sysdate)) then dt end)
from   dates
where  to_char(dt, &#039;DY&#039;, &#039;nls_date_language=english&#039;) not in (&#039;SAT&#039;, &#039;SUN&#039;)
and    dt not in (select bh_date from bank_holidays)
&lt;/pre&gt;

*hangs head*]]></description>
		<content:encoded><![CDATA[<p>I think I&#8217;m going to give up; clearly I can&#8217;t master the art of C&amp;P!</p>
<p>This is hopefully the correct version, using sysdate etc:</p>
<pre>
with dates as (select trunc(sysdate, 'mm') + 21 + level dt -- 23rd of the month and onwards
               from   dual
               connect by level &lt;= 5
               union
               select last_day(trunc(sysdate)) + level dt -- 1st of next month and onwards
               from   dual
               connect by level  last_day(trunc(sysdate)) then dt end)
from   dates
where  to_char(dt, 'DY', 'nls_date_language=english') not in ('SAT', 'SUN')
and    dt not in (select bh_date from bank_holidays)
</pre>
<p>*hangs head*</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Boneist</title>
		<link>http://mikesmithers.wordpress.com/2011/07/31/if-you-cant-do-it-in-plsql-do-it-in-sql/#comment-4594</link>
		<dc:creator><![CDATA[Boneist]]></dc:creator>
		<pubDate>Thu, 04 Aug 2011 14:20:12 +0000</pubDate>
		<guid isPermaLink="false">http://mikesmithers.wordpress.com/?p=1086#comment-4594</guid>
		<description><![CDATA[Gosh, the middle bit of my query got eaten up somewhere along the line!

It should be (I&#039;ve used sysdate; obviously that&#039;d need to be changed to a parameter etc)

&lt;pre&gt;
with dates as (select trunc(:p_date) + 21 + level dt -- 23rd of the month and onwards
               from   dual
               connect by level &lt;= 5
               union
               select last_day(trunc(:p_date)) + level dt -- 1st of next month and onwards
               from   dual
               connect by level  last_day(trunc(:p_date)) then dt end)
select min(dt), max(dt)
from   dates
where  to_char(dt, &#039;DY&#039;, &#039;nls_date_language=english&#039;) not in (&#039;SAT&#039;, &#039;SUN&#039;)
and    dt not in (select bh_date from bank_holidays);
&lt;/pre&gt;]]></description>
		<content:encoded><![CDATA[<p>Gosh, the middle bit of my query got eaten up somewhere along the line!</p>
<p>It should be (I&#8217;ve used sysdate; obviously that&#8217;d need to be changed to a parameter etc)</p>
<pre>
with dates as (select trunc(:p_date) + 21 + level dt -- 23rd of the month and onwards
               from   dual
               connect by level &lt;= 5
               union
               select last_day(trunc(:p_date)) + level dt -- 1st of next month and onwards
               from   dual
               connect by level  last_day(trunc(:p_date)) then dt end)
select min(dt), max(dt)
from   dates
where  to_char(dt, &#039;DY&#039;, &#039;nls_date_language=english&#039;) not in (&#039;SAT&#039;, &#039;SUN&#039;)
and    dt not in (select bh_date from bank_holidays);
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Boneist</title>
		<link>http://mikesmithers.wordpress.com/2011/07/31/if-you-cant-do-it-in-plsql-do-it-in-sql/#comment-4061</link>
		<dc:creator><![CDATA[Boneist]]></dc:creator>
		<pubDate>Mon, 01 Aug 2011 09:16:00 +0000</pubDate>
		<guid isPermaLink="false">http://mikesmithers.wordpress.com/?p=1086#comment-4061</guid>
		<description><![CDATA[An alternative would be:

&lt;pre&gt;
with dates as (select trunc(:p_date) + 21 + level dt -- 23rd of the month and onwards
               from   dual
               connect by level &lt;= 5
               union
               select last_day(trunc(:p_date)) + level dt -- 1st of next month and onwards
               from   dual
               connect by level  last_day(trunc(:p_date)) then dt end)
from   dates
where  to_char(dt, &#039;DY&#039;, &#039;nls_date_language=english&#039;) not in (&#039;SAT&#039;, &#039;SUN&#039;)
and    dt not in (select bh_date from bank_holidays)
&lt;/pre&gt;]]></description>
		<content:encoded><![CDATA[<p>An alternative would be:</p>
<pre>
with dates as (select trunc(:p_date) + 21 + level dt -- 23rd of the month and onwards
               from   dual
               connect by level &lt;= 5
               union
               select last_day(trunc(:p_date)) + level dt -- 1st of next month and onwards
               from   dual
               connect by level  last_day(trunc(:p_date)) then dt end)
from   dates
where  to_char(dt, 'DY', 'nls_date_language=english') not in ('SAT', 'SUN')
and    dt not in (select bh_date from bank_holidays)
</pre>
]]></content:encoded>
	</item>
</channel>
</rss>
