<?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: Closed database and WITH subquery</title>
	<atom:link href="http://blog.tanelpoder.com/2008/07/14/closed-database-and-with-subquery/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.tanelpoder.com/2008/07/14/closed-database-and-with-subquery/</link>
	<description>Oracle troubleshooting, internals and performance tuning</description>
	<lastBuildDate>Sat, 13 Mar 2010 00:19:38 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Tanel Poder</title>
		<link>http://blog.tanelpoder.com/2008/07/14/closed-database-and-with-subquery/comment-page-1/#comment-2223</link>
		<dc:creator>Tanel Poder</dc:creator>
		<pubDate>Mon, 27 Jul 2009 10:39:20 +0000</pubDate>
		<guid isPermaLink="false">http://tanelpoder.wordpress.com/2008/07/14/closed-database-and-with-subquery/#comment-2223</guid>
		<description>that query doesnt work as shown above</description>
		<content:encoded><![CDATA[<p>that query doesnt work as shown above</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: hashim</title>
		<link>http://blog.tanelpoder.com/2008/07/14/closed-database-and-with-subquery/comment-page-1/#comment-2222</link>
		<dc:creator>hashim</dc:creator>
		<pubDate>Mon, 27 Jul 2009 10:30:29 +0000</pubDate>
		<guid isPermaLink="false">http://tanelpoder.wordpress.com/2008/07/14/closed-database-and-with-subquery/#comment-2222</guid>
		<description>with subquery as (select /*+ inline */ ‘blah’ x from dual) select * from subquery;</description>
		<content:encoded><![CDATA[<p>with subquery as (select /*+ inline */ ‘blah’ x from dual) select * from subquery;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tanelp</title>
		<link>http://blog.tanelpoder.com/2008/07/14/closed-database-and-with-subquery/comment-page-1/#comment-462</link>
		<dc:creator>tanelp</dc:creator>
		<pubDate>Tue, 22 Jul 2008 14:27:14 +0000</pubDate>
		<guid isPermaLink="false">http://tanelpoder.wordpress.com/2008/07/14/closed-database-and-with-subquery/#comment-462</guid>
		<description>Hi Nilendu,

Did you test out your claims first?

SQL&gt; with subquery as (select /*+ inline */ &#039;blah&#039; x from dual) select * from subquery;
with subquery as (select /*+ inline */ &#039;blah&#039; x from dual) select * from subquery
                                                                         *
ERROR at line 1:
ORA-01219: database not open: queries allowed on fixed tables/views only


This error is not due view materialization into GTT, if it was the error message would have been different as well.</description>
		<content:encoded><![CDATA[<p>Hi Nilendu,</p>
<p>Did you test out your claims first?</p>
<p>SQL&gt; with subquery as (select /*+ inline */ &#8216;blah&#8217; x from dual) select * from subquery;<br />
with subquery as (select /*+ inline */ &#8216;blah&#8217; x from dual) select * from subquery<br />
                                                                         *<br />
ERROR at line 1:<br />
ORA-01219: database not open: queries allowed on fixed tables/views only</p>
<p>This error is not due view materialization into GTT, if it was the error message would have been different as well.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nilendu</title>
		<link>http://blog.tanelpoder.com/2008/07/14/closed-database-and-with-subquery/comment-page-1/#comment-463</link>
		<dc:creator>Nilendu</dc:creator>
		<pubDate>Fri, 18 Jul 2008 05:24:19 +0000</pubDate>
		<guid isPermaLink="false">http://tanelpoder.wordpress.com/2008/07/14/closed-database-and-with-subquery/#comment-463</guid>
		<description>Oops! I mean --

SQL&gt; with  subquery as (select /*+ inline */ &#039;blah&#039; x from dual) select * from subquery;</description>
		<content:encoded><![CDATA[<p>Oops! I mean &#8211;</p>
<p>SQL&gt; with  subquery as (select /*+ inline */ &#8216;blah&#8217; x from dual) select * from subquery;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nilendu</title>
		<link>http://blog.tanelpoder.com/2008/07/14/closed-database-and-with-subquery/comment-page-1/#comment-464</link>
		<dc:creator>Nilendu</dc:creator>
		<pubDate>Fri, 18 Jul 2008 05:21:52 +0000</pubDate>
		<guid isPermaLink="false">http://tanelpoder.wordpress.com/2008/07/14/closed-database-and-with-subquery/#comment-464</guid>
		<description>This is because Oracle is trying to build a global temporary table with database still not open.

Try this hint, this should work --

SQL&gt; with /*+ inline */ subquery as (select &#039;blah&#039; x from dual) select * from subquery;</description>
		<content:encoded><![CDATA[<p>This is because Oracle is trying to build a global temporary table with database still not open.</p>
<p>Try this hint, this should work &#8211;</p>
<p>SQL&gt; with /*+ inline */ subquery as (select &#8216;blah&#8217; x from dual) select * from subquery;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tanelp</title>
		<link>http://blog.tanelpoder.com/2008/07/14/closed-database-and-with-subquery/comment-page-1/#comment-469</link>
		<dc:creator>tanelp</dc:creator>
		<pubDate>Wed, 16 Jul 2008 07:02:27 +0000</pubDate>
		<guid isPermaLink="false">http://tanelpoder.wordpress.com/2008/07/14/closed-database-and-with-subquery/#comment-469</guid>
		<description>Yep it looks like the DUAL -&gt; X$DUAL replacement is done only in the main query body and not in the factored subquery.

This for example works:

SQL&gt; with x$dual as (select 1 x from v$instance) select * from x$dual;

         X
----------
         1


These two work ok too:

SQL&gt; select * from (select * from dual);

ADDR           INDX    INST_ID D
-------- ---------- ---------- -
0C60FA34          0          1 X


SQL&gt; select * from dual where dummy in (select dummy from dual);

ADDR           INDX    INST_ID D
-------- ---------- ---------- -
0C60FA34          0          1 X


So it looks like this issue is specific to subquery factoring.</description>
		<content:encoded><![CDATA[<p>Yep it looks like the DUAL -&gt; X$DUAL replacement is done only in the main query body and not in the factored subquery.</p>
<p>This for example works:</p>
<p>SQL&gt; with x$dual as (select 1 x from v$instance) select * from x$dual;</p>
<p>         X<br />
&#8212;&#8212;&#8212;-<br />
         1</p>
<p>These two work ok too:</p>
<p>SQL&gt; select * from (select * from dual);</p>
<p>ADDR           INDX    INST_ID D<br />
&#8212;&#8212;&#8211; &#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;- -<br />
0C60FA34          0          1 X</p>
<p>SQL&gt; select * from dual where dummy in (select dummy from dual);</p>
<p>ADDR           INDX    INST_ID D<br />
&#8212;&#8212;&#8211; &#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;- -<br />
0C60FA34          0          1 X</p>
<p>So it looks like this issue is specific to subquery factoring.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: laurentschneider</title>
		<link>http://blog.tanelpoder.com/2008/07/14/closed-database-and-with-subquery/comment-page-1/#comment-468</link>
		<dc:creator>laurentschneider</dc:creator>
		<pubDate>Wed, 16 Jul 2008 05:13:42 +0000</pubDate>
		<guid isPermaLink="false">http://tanelpoder.wordpress.com/2008/07/14/closed-database-and-with-subquery/#comment-468</guid>
		<description>yes, quite special :)

SQL&gt; with x$dual as (select &#039;1&#039; from dual) select * from x$dual;
ORA-32031: illegal reference of a query name in WITH clause</description>
		<content:encoded><![CDATA[<p>yes, quite special :)</p>
<p>SQL&gt; with x$dual as (select &#8216;1&#8242; from dual) select * from x$dual;<br />
ORA-32031: illegal reference of a query name in WITH clause</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tanelp</title>
		<link>http://blog.tanelpoder.com/2008/07/14/closed-database-and-with-subquery/comment-page-1/#comment-467</link>
		<dc:creator>tanelp</dc:creator>
		<pubDate>Tue, 15 Jul 2008 10:22:32 +0000</pubDate>
		<guid isPermaLink="false">http://tanelpoder.wordpress.com/2008/07/14/closed-database-and-with-subquery/#comment-467</guid>
		<description>DUAL is another special case btw, when you select from it when DB is closed, then internally the name is converted to X$DUAL..</description>
		<content:encoded><![CDATA[<p>DUAL is another special case btw, when you select from it when DB is closed, then internally the name is converted to X$DUAL..</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tanelp</title>
		<link>http://blog.tanelpoder.com/2008/07/14/closed-database-and-with-subquery/comment-page-1/#comment-466</link>
		<dc:creator>tanelp</dc:creator>
		<pubDate>Tue, 15 Jul 2008 10:21:44 +0000</pubDate>
		<guid isPermaLink="false">http://tanelpoder.wordpress.com/2008/07/14/closed-database-and-with-subquery/#comment-466</guid>
		<description>yep, as DUAL table name is not in the hardcoded fixed table list. If you replace DUAL with X$DUAL in your query, it works.</description>
		<content:encoded><![CDATA[<p>yep, as DUAL table name is not in the hardcoded fixed table list. If you replace DUAL with X$DUAL in your query, it works.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: laurentschneider</title>
		<link>http://blog.tanelpoder.com/2008/07/14/closed-database-and-with-subquery/comment-page-1/#comment-465</link>
		<dc:creator>laurentschneider</dc:creator>
		<pubDate>Tue, 15 Jul 2008 09:52:18 +0000</pubDate>
		<guid isPermaLink="false">http://tanelpoder.wordpress.com/2008/07/14/closed-database-and-with-subquery/#comment-465</guid>
		<description>Fun, but it works only in one direction :mrgreen:

&lt;code&gt;with dual as (select &#039;x&#039; from v$instance) select * from dual;
with dual as (select &#039;x&#039; from v$instance) select * from dual
                                                        *
ERROR at line 1:
ORA-32035: unreferenced query name defined in WITH clause
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>Fun, but it works only in one direction :mrgreen:</p>
<p><code>with dual as (select 'x' from v$instance) select * from dual;<br />
with dual as (select 'x' from v$instance) select * from dual<br />
                                                        *<br />
ERROR at line 1:<br />
ORA-32035: unreferenced query name defined in WITH clause<br />
</code></p>
]]></content:encoded>
	</item>
</channel>
</rss>
