<?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 generate multiple rows from a single row based on a date range</title>
	<atom:link href="http://oraqa.com/2007/03/01/how-to-generate-multiple-rows-from-a-single-row-based-on-a-date-range/feed/" rel="self" type="application/rss+xml" />
	<link>http://oraqa.com/2007/03/01/how-to-generate-multiple-rows-from-a-single-row-based-on-a-date-range/</link>
	<description>Oracle Question and Answer</description>
	<lastBuildDate>Wed, 29 Jul 2009 16:01:28 -0600</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Laurent Schneider</title>
		<link>http://oraqa.com/2007/03/01/how-to-generate-multiple-rows-from-a-single-row-based-on-a-date-range/comment-page-1/#comment-234</link>
		<dc:creator>Laurent Schneider</dc:creator>
		<pubDate>Thu, 06 Mar 2008 07:32:04 +0000</pubDate>
		<guid isPermaLink="false">http://oraqa.com/2007/03/01/how-to-generate-multiple-rows-from-a-single-row-based-on-a-date-range/#comment-234</guid>
		<description>about the ORA-1436 please monitor enhancement request 6801807 on metalink</description>
		<content:encoded><![CDATA[<p>about the ORA-1436 please monitor enhancement request 6801807 on metalink</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: stewstryker</title>
		<link>http://oraqa.com/2007/03/01/how-to-generate-multiple-rows-from-a-single-row-based-on-a-date-range/comment-page-1/#comment-229</link>
		<dc:creator>stewstryker</dc:creator>
		<pubDate>Fri, 04 Jan 2008 01:01:05 +0000</pubDate>
		<guid isPermaLink="false">http://oraqa.com/2007/03/01/how-to-generate-multiple-rows-from-a-single-row-based-on-a-date-range/#comment-229</guid>
		<description>Thanks for the reply.  I tried about 8 times using various interfaces and always got the same error.  Oh well!</description>
		<content:encoded><![CDATA[<p>Thanks for the reply.  I tried about 8 times using various interfaces and always got the same error.  Oh well!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Laurent Schneider</title>
		<link>http://oraqa.com/2007/03/01/how-to-generate-multiple-rows-from-a-single-row-based-on-a-date-range/comment-page-1/#comment-228</link>
		<dc:creator>Laurent Schneider</dc:creator>
		<pubDate>Thu, 03 Jan 2008 21:57:11 +0000</pubDate>
		<guid isPermaLink="false">http://oraqa.com/2007/03/01/how-to-generate-multiple-rows-from-a-single-row-based-on-a-date-range/#comment-228</guid>
		<description>try to run in more than once and you will see it works sometimes. 

about the error manual, I have reported that to the doc owner, good catch!</description>
		<content:encoded><![CDATA[<p>try to run in more than once and you will see it works sometimes. </p>
<p>about the error manual, I have reported that to the doc owner, good catch!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: stewstryker</title>
		<link>http://oraqa.com/2007/03/01/how-to-generate-multiple-rows-from-a-single-row-based-on-a-date-range/comment-page-1/#comment-227</link>
		<dc:creator>stewstryker</dc:creator>
		<pubDate>Thu, 03 Jan 2008 21:25:44 +0000</pubDate>
		<guid isPermaLink="false">http://oraqa.com/2007/03/01/how-to-generate-multiple-rows-from-a-single-row-based-on-a-date-range/#comment-227</guid>
		<description>Hmm, when I try Laurent&#039;s version:
&lt;pre&gt;select rownum from dual connect by level &lt; 3 
   and prior trunc(dbms_random.value(1,3)) is not null;&lt;/pre&gt;
I get the error:

ORA-01436: CONNECT BY loop in user data

Strangely, I can&#039;t find that error in the manual...  We&#039;re running 10.2.0.3.0

[sigh]</description>
		<content:encoded><![CDATA[<p>Hmm, when I try Laurent&#8217;s version:</p>
<pre>select rownum from dual connect by level &lt; 3
   and prior trunc(dbms_random.value(1,3)) is not null;</pre>
<p>I get the error:</p>
<p>ORA-01436: CONNECT BY loop in user data</p>
<p>Strangely, I can&#8217;t find that error in the manual&#8230;  We&#8217;re running 10.2.0.3.0</p>
<p>[sigh]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Laurent Schneider</title>
		<link>http://oraqa.com/2007/03/01/how-to-generate-multiple-rows-from-a-single-row-based-on-a-date-range/comment-page-1/#comment-207</link>
		<dc:creator>Laurent Schneider</dc:creator>
		<pubDate>Wed, 21 Mar 2007 12:46:08 +0000</pubDate>
		<guid isPermaLink="false">http://oraqa.com/2007/03/01/how-to-generate-multiple-rows-from-a-single-row-based-on-a-date-range/#comment-207</guid>
		<description>the &lt; did not work, here again with &lt;
&lt;pre&gt;
select rownum from dual connect by level &lt; 3 and prior trunc(dbms_random.value(1,3)) is not null;
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>the &lt; did not work, here again with &amp;lt;</p>
<pre>
select rownum from dual connect by level &lt; 3 and prior trunc(dbms_random.value(1,3)) is not null;
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Laurent Schneider</title>
		<link>http://oraqa.com/2007/03/01/how-to-generate-multiple-rows-from-a-single-row-based-on-a-date-range/comment-page-1/#comment-206</link>
		<dc:creator>Laurent Schneider</dc:creator>
		<pubDate>Wed, 21 Mar 2007 12:44:24 +0000</pubDate>
		<guid isPermaLink="false">http://oraqa.com/2007/03/01/how-to-generate-multiple-rows-from-a-single-row-based-on-a-date-range/#comment-206</guid>
		<description>well, connect by without prior is not supported. But using &lt;i&gt;connect by prior dbms_random.value is not null&lt;/i&gt; is not fair. First it may fail anytime, like the following query works 50% of the time 
&lt;pre&gt;
select rownum from dual connect by level 

(of course yours works 99.99% )

what&#039;s more, it is such a hack that I would never rely on it. The optimizer may change the plan and it may suddenly fail in a next patchset. 

Actually, I would prefer to have ORA-1436 in any connect by without prior, but we will have to wait 12gR2 to see it ;-)</description>
		<content:encoded><![CDATA[<p>well, connect by without prior is not supported. But using <i>connect by prior dbms_random.value is not null</i> is not fair. First it may fail anytime, like the following query works 50% of the time </p>
<pre>
select rownum from dual connect by level 

(of course yours works 99.99% )

what's more, it is such a hack that I would never rely on it. The optimizer may change the plan and it may suddenly fail in a next patchset. 

Actually, I would prefer to have ORA-1436 in any connect by without prior, but we will have to wait 12gR2 to see it ;-)</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: mkapadia</title>
		<link>http://oraqa.com/2007/03/01/how-to-generate-multiple-rows-from-a-single-row-based-on-a-date-range/comment-page-1/#comment-203</link>
		<dc:creator>mkapadia</dc:creator>
		<pubDate>Wed, 14 Mar 2007 14:41:43 +0000</pubDate>
		<guid isPermaLink="false">http://oraqa.com/2007/03/01/how-to-generate-multiple-rows-from-a-single-row-based-on-a-date-range/#comment-203</guid>
		<description>..continuation from previous query:

          CONNECT BY LEVEL </description>
		<content:encoded><![CDATA[<p>..continuation from previous query:</p>
<p>          CONNECT BY LEVEL</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mkapadia</title>
		<link>http://oraqa.com/2007/03/01/how-to-generate-multiple-rows-from-a-single-row-based-on-a-date-range/comment-page-1/#comment-202</link>
		<dc:creator>mkapadia</dc:creator>
		<pubDate>Wed, 14 Mar 2007 14:38:29 +0000</pubDate>
		<guid isPermaLink="false">http://oraqa.com/2007/03/01/how-to-generate-multiple-rows-from-a-single-row-based-on-a-date-range/#comment-202</guid>
		<description>SELECT   TO_CHAR(ADD_MONTHS (start_year, (12 * r) - 12), &#039;YYYY&#039;) my
   FROM (
          SELECT TRUNC (start_date, &#039;YEAR&#039;) AS start_year, TRUNC    
                 (end_date, &#039;YEAR&#039;) AS end_year,
                 TO_CHAR (TRUNC (end_date, &#039;YEAR&#039;), &#039;YYYY&#039;) - 
                 TO_CHAR (TRUNC (start_date, &#039;YEAR&#039;), &#039;YYYY&#039;) + 1
                 AS yr
            FROM t2
           ORDER BY start_date, end_date
         ) a,
         (SELECT LEVEL r
            FROM DUAL
         CONNECT BY LEVEL </description>
		<content:encoded><![CDATA[<p>SELECT   TO_CHAR(ADD_MONTHS (start_year, (12 * r) &#8211; 12), &#8216;YYYY&#8217;) my<br />
   FROM (<br />
          SELECT TRUNC (start_date, &#8216;YEAR&#8217;) AS start_year, TRUNC<br />
                 (end_date, &#8216;YEAR&#8217;) AS end_year,<br />
                 TO_CHAR (TRUNC (end_date, &#8216;YEAR&#8217;), &#8216;YYYY&#8217;) &#8211;<br />
                 TO_CHAR (TRUNC (start_date, &#8216;YEAR&#8217;), &#8216;YYYY&#8217;) + 1<br />
                 AS yr<br />
            FROM t2<br />
           ORDER BY start_date, end_date<br />
         ) a,<br />
         (SELECT LEVEL r<br />
            FROM DUAL<br />
         CONNECT BY LEVEL</p>
]]></content:encoded>
	</item>
</channel>
</rss>
