<?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: Courtesy of Tom Kyte: Generating rows in SQL with the CUBE statement &#8211; no dummy table or table function required</title>
	<atom:link href="http://technology.amis.nl/blog/392/courtesy-of-tom-kyte-generating-rows-in-sql-with-the-cube-statement-no-dummy-table-or-table-function-required/feed" rel="self" type="application/rss+xml" />
	<link>http://technology.amis.nl/blog/392/courtesy-of-tom-kyte-generating-rows-in-sql-with-the-cube-statement-no-dummy-table-or-table-function-required</link>
	<description>Weblog for the AMIS Technology corner</description>
	<lastBuildDate>Fri, 10 Feb 2012 16:47:37 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Bert de Geus</title>
		<link>http://technology.amis.nl/blog/392/courtesy-of-tom-kyte-generating-rows-in-sql-with-the-cube-statement-no-dummy-table-or-table-function-required/comment-page-1#comment-266741</link>
		<dc:creator>Bert de Geus</dc:creator>
		<pubDate>Tue, 06 Nov 2007 09:17:54 +0000</pubDate>
		<guid isPermaLink="false">/?p=392#comment-266741</guid>
		<description>select rownum from (select 1 from dual group by cube(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20));

is slow but using a carthesian join is fast.

select rownum
from (select 1 from dual group by (cube(1,2,3,4,5,6,7,8,9,10))
,       (select 1 from dual group by (cube(1,2,3,4,5,6,7,8,9,10));

and deleivers the same number of rows.
This is faster than

select count(rownum )  FROM dual CONNECT BY ROWNUM </description>
		<content:encoded><![CDATA[<p>select rownum from (select 1 from dual group by cube(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20));</p>
<p>is slow but using a carthesian join is fast.</p>
<p>select rownum<br />
from (select 1 from dual group by (cube(1,2,3,4,5,6,7,8,9,10))<br />
,       (select 1 from dual group by (cube(1,2,3,4,5,6,7,8,9,10));</p>
<p>and deleivers the same number of rows.<br />
This is faster than</p>
<p>select count(rownum )  FROM dual CONNECT BY ROWNUM</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: AMIS Technology blog &#187; Blog Archive &#187; Puzzelen met SQL – Testdata Generatie</title>
		<link>http://technology.amis.nl/blog/392/courtesy-of-tom-kyte-generating-rows-in-sql-with-the-cube-statement-no-dummy-table-or-table-function-required/comment-page-1#comment-265311</link>
		<dc:creator>AMIS Technology blog &#187; Blog Archive &#187; Puzzelen met SQL – Testdata Generatie</dc:creator>
		<pubDate>Mon, 22 Oct 2007 10:51:49 +0000</pubDate>
		<guid isPermaLink="false">/?p=392#comment-265311</guid>
		<description>[...] We gebruiken hier trouwens de tabel all_source als een dummy tabel om 250 records te selecteren, zie http://technology.amis.nl/blog/?p=392 voor een andere manier om records te genereren. [...]</description>
		<content:encoded><![CDATA[<p>[...] We gebruiken hier trouwens de tabel all_source als een dummy tabel om 250 records te selecteren, zie <a href="http://technology.amis.nl/blog/?p=392" rel="nofollow">http://technology.amis.nl/blog/?p=392</a> voor een andere manier om records te genereren. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: harm</title>
		<link>http://technology.amis.nl/blog/392/courtesy-of-tom-kyte-generating-rows-in-sql-with-the-cube-statement-no-dummy-table-or-table-function-required/comment-page-1#comment-37206</link>
		<dc:creator>harm</dc:creator>
		<pubDate>Thu, 25 Aug 2005 12:06:38 +0000</pubDate>
		<guid isPermaLink="false">/?p=392#comment-37206</guid>
		<description>Je moet quotes, kleiner dan , groter dan etc. escapen alsof je html of xml typt. Dus met een ampersand ervoor en een punt-komma erachter. Of, wat soms ook lukt, is een pre tag ervoor en een pre tag erna.</description>
		<content:encoded><![CDATA[<p>Je moet quotes, kleiner dan , groter dan etc. escapen alsof je html of xml typt. Dus met een ampersand ervoor en een punt-komma erachter. Of, wat soms ook lukt, is een pre tag ervoor en een pre tag erna.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alex Nuijten</title>
		<link>http://technology.amis.nl/blog/392/courtesy-of-tom-kyte-generating-rows-in-sql-with-the-cube-statement-no-dummy-table-or-table-function-required/comment-page-1#comment-37193</link>
		<dc:creator>Alex Nuijten</dc:creator>
		<pubDate>Thu, 25 Aug 2005 10:47:40 +0000</pubDate>
		<guid isPermaLink="false">/?p=392#comment-37193</guid>
		<description>Anton,
Thanks for clearing that up. ;-)</description>
		<content:encoded><![CDATA[<p>Anton,<br />
Thanks for clearing that up. <img src='http://technology.amis.nl/blog/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: anton</title>
		<link>http://technology.amis.nl/blog/392/courtesy-of-tom-kyte-generating-rows-in-sql-with-the-cube-statement-no-dummy-table-or-table-function-required/comment-page-1#comment-37179</link>
		<dc:creator>anton</dc:creator>
		<pubDate>Thu, 25 Aug 2005 08:41:09 +0000</pubDate>
		<guid isPermaLink="false">/?p=392#comment-37179</guid>
		<description>&lt;pre&gt;
Alex, I didn`t leave anything out of the scripts,
but the software which displays this blog (or the browser ) couldn`t handle the &quot;smaller than sign&quot;  &lt; I used.
And updating a message doesn`t like the single quote &#039; by the way
&lt;/pre&gt;
</description>
		<content:encoded><![CDATA[<pre>
Alex, I didn`t leave anything out of the scripts,
but the software which displays this blog (or the browser ) couldn`t handle the "smaller than sign"  < I used.
And updating a message doesn`t like the single quote ' by the way
</pre>
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alex Nuijten</title>
		<link>http://technology.amis.nl/blog/392/courtesy-of-tom-kyte-generating-rows-in-sql-with-the-cube-statement-no-dummy-table-or-table-function-required/comment-page-1#comment-37155</link>
		<dc:creator>Alex Nuijten</dc:creator>
		<pubDate>Wed, 24 Aug 2005 08:28:20 +0000</pubDate>
		<guid isPermaLink="false">/?p=392#comment-37155</guid>
		<description>Anton,

On all three of your suggestions I got: ERROR at line 1:ORA-00920: invalid relational operator
SQL&gt; select rownum from dual connect by rownum
  2  /
select rownum from dual connect by rownum
                                        *
ERROR at line 1:
ORA-00920: invalid relational operator

Did you leave something out of the scripts? (on the second one, there is a parenthesis missing)

What also works as a row-generator:
&lt;pre&gt;
select *
  from (select level l
          from dual
       connect by level &lt; = 6
       )
/
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>Anton,</p>
<p>On all three of your suggestions I got: ERROR at line 1:ORA-00920: invalid relational operator<br />
SQL> select rownum from dual connect by rownum<br />
  2  /<br />
select rownum from dual connect by rownum<br />
                                        *<br />
ERROR at line 1:<br />
ORA-00920: invalid relational operator</p>
<p>Did you leave something out of the scripts? (on the second one, there is a parenthesis missing)</p>
<p>What also works as a row-generator:</p>
<pre>
select *
  from (select level l
          from dual
       connect by level < = 6
       )
/
</pre>
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: anton</title>
		<link>http://technology.amis.nl/blog/392/courtesy-of-tom-kyte-generating-rows-in-sql-with-the-cube-statement-no-dummy-table-or-table-function-required/comment-page-1#comment-37119</link>
		<dc:creator>anton</dc:creator>
		<pubDate>Tue, 23 Aug 2005 15:09:48 +0000</pubDate>
		<guid isPermaLink="false">/?p=392#comment-37119</guid>
		<description>&lt;pre&gt;
Another number generator is &quot;select rownum from dual connect by rownum &lt; 10&quot;

select to_char( days.day + to_date(&#039;21-11-2004&#039;,&#039;DD-MM-YYYY&#039;),&#039;DAY&#039;) day
from ( select rownum day from dual connect by rownum &lt; 8 ) days

And select count(rownum )  FROM dual CONNECT BY ROWNUM &lt; 1048576 takes 4 seconds

Updated: the database which stores this blog didn`t liked the &lt; and quotes in my message, 
&lt;/pre&gt;
</description>
		<content:encoded><![CDATA[<pre>
Another number generator is "select rownum from dual connect by rownum < 10"

select to_char( days.day + to_date('21-11-2004','DD-MM-YYYY'),'DAY') day
from ( select rownum day from dual connect by rownum < 8 ) days

And select count(rownum )  FROM dual CONNECT BY ROWNUM < 1048576 takes 4 seconds

Updated: the database which stores this blog didn`t liked the < and quotes in my message,
</pre>
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: harm</title>
		<link>http://technology.amis.nl/blog/392/courtesy-of-tom-kyte-generating-rows-in-sql-with-the-cube-statement-no-dummy-table-or-table-function-required/comment-page-1#comment-25814</link>
		<dc:creator>harm</dc:creator>
		<pubDate>Thu, 02 Jun 2005 09:54:24 +0000</pubDate>
		<guid isPermaLink="false">/?p=392#comment-25814</guid>
		<description>I wa looking for a script to generate lots of dates, grouped by quarter, month and year. Starting with Lucas&#039; day-generator script I experienced problems with leap years. I adjusted the script so it generates months in stead of days. Following is a leap year compliant script that generates months, quarters and years:

select to_char(add_months(to_date(&#039;01-12-1996&#039;,&#039;DD-MM-YYYY&#039;), r.months), &#039;Q&#039;) kwartaal
,      to_char(add_months(to_date(&#039;01-12-1996&#039;,&#039;DD-MM-YYYY&#039;), r.months), &#039;MONTH&#039;, &#039;NLS_DATE_LANGUAGE = dutch&#039;) maand
,      to_char(add_months(to_date(&#039;01-12-1996&#039;,&#039;DD-MM-YYYY&#039;), r.months), &#039;YYYY&#039;) jaar
--,      last_day(add_months(to_date(&#039;01-12-1996&#039;,&#039;DD-MM-YYYY&#039;), r.months)) last_day
FROM   ( select rownum   months
         from   ( select 0
                  from   dual
                  group
                  by     cube (1,2,3,4,5,6,7,8)
                )
       ) r
;</description>
		<content:encoded><![CDATA[<p>I wa looking for a script to generate lots of dates, grouped by quarter, month and year. Starting with Lucas&#8217; day-generator script I experienced problems with leap years. I adjusted the script so it generates months in stead of days. Following is a leap year compliant script that generates months, quarters and years:</p>
<p>select to_char(add_months(to_date(&#8216;01-12-1996&#8242;,&#8217;DD-MM-YYYY&#8217;), r.months), &#8216;Q&#8217;) kwartaal<br />
,      to_char(add_months(to_date(&#8216;01-12-1996&#8242;,&#8217;DD-MM-YYYY&#8217;), r.months), &#8216;MONTH&#8217;, &#8216;NLS_DATE_LANGUAGE = dutch&#8217;) maand<br />
,      to_char(add_months(to_date(&#8216;01-12-1996&#8242;,&#8217;DD-MM-YYYY&#8217;), r.months), &#8216;YYYY&#8217;) jaar<br />
&#8211;,      last_day(add_months(to_date(&#8216;01-12-1996&#8242;,&#8217;DD-MM-YYYY&#8217;), r.months)) last_day<br />
FROM   ( select rownum   months<br />
         from   ( select 0<br />
                  from   dual<br />
                  group<br />
                  by     cube (1,2,3,4,5,6,7,8)<br />
                )<br />
       ) r<br />
;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alex Nuijten</title>
		<link>http://technology.amis.nl/blog/392/courtesy-of-tom-kyte-generating-rows-in-sql-with-the-cube-statement-no-dummy-table-or-table-function-required/comment-page-1#comment-25408</link>
		<dc:creator>Alex Nuijten</dc:creator>
		<pubDate>Tue, 31 May 2005 06:03:44 +0000</pubDate>
		<guid isPermaLink="false">/?p=392#comment-25408</guid>
		<description>I happen to see &lt;a href=&quot;http://asktom.oracle.com/pls/ask/f?p=4950:8:10834408111167059045::NO::F4950_P8_DISPLAYID,F4950_P8_CRITERIA:40476301944675&quot; target=&quot;_blank&quot;&gt;this&lt;/a&gt; titled &#039;Weird Results&#039; on askTom. It kinda explains the result I saw in comment 1.
(just to let you know)</description>
		<content:encoded><![CDATA[<p>I happen to see <a href="http://asktom.oracle.com/pls/ask/f?p=4950:8:10834408111167059045::NO::F4950_P8_DISPLAYID,F4950_P8_CRITERIA:40476301944675" target="_blank">this</a> titled &#8216;Weird Results&#8217; on askTom. It kinda explains the result I saw in comment 1.<br />
(just to let you know)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lucas</title>
		<link>http://technology.amis.nl/blog/392/courtesy-of-tom-kyte-generating-rows-in-sql-with-the-cube-statement-no-dummy-table-or-table-function-required/comment-page-1#comment-3938</link>
		<dc:creator>Lucas</dc:creator>
		<pubDate>Sun, 13 Feb 2005 14:01:55 +0000</pubDate>
		<guid isPermaLink="false">/?p=392#comment-3938</guid>
		<description>I think for generating 1 million records it is much better to use a table (or cartesian product in an in-line view) that you know to contain at least a million records. This CUBE approach seems best suited for small numbers (say up to a 1000). Perhaps one day I will benchmark the Table Function, Model, Cube and Dummy Table approach.</description>
		<content:encoded><![CDATA[<p>I think for generating 1 million records it is much better to use a table (or cartesian product in an in-line view) that you know to contain at least a million records. This CUBE approach seems best suited for small numbers (say up to a 1000). Perhaps one day I will benchmark the Table Function, Model, Cube and Dummy Table approach.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

