<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>ORACLE-BASE Blog Aggregator &#187; Tanel Poder</title>
	<atom:link href="http://www.oracle-base.com/aggregator/author/tanel-poder/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.oracle-base.com/aggregator</link>
	<description>Blogs I follow...</description>
	<lastBuildDate>Mon, 06 Feb 2012 11:08:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Is this valid SQL syntax? :-)</title>
		<link>http://blog.tanelpoder.com/2011/01/10/is-this-valid-sql-syntax/</link>
		<comments>http://blog.tanelpoder.com/2011/01/10/is-this-valid-sql-syntax/#comments</comments>
		<pubDate>Mon, 10 Jan 2011 23:07:56 +0000</pubDate>
		<dc:creator>Tanel Poder</dc:creator>
		
		<guid isPermaLink="false">http://blog.tanelpoder.com/2011/01/10/is-this-valid-sql-syntax/</guid>
		<description><![CDATA[I&#8217;m talking about this: select-1from from dual; Looks like invalid, right? Well, let&#8217;s run it: SQL&#062; select-1from from dual; &#160;&#160;&#160;&#160;&#160;&#160; ROM ---------- &#160;-1.0E+000 This is because: Oracle doesn&#8217;t need whitespace for tokenizing the SQL statement (differences in character classes will do &#8211; as I&#8217;ve explained here) The first from &#8220;keyword&#8221; in the above statement is [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m talking about this:</p>
<p><b>select-1from from dual;<br />
</b><br />
Looks like invalid, right? Well, let&#8217;s run it:</p>
<pre>
SQL&gt; select-1from from dual;

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ROM
----------
&nbsp;-1.0E+000
</pre>
<p>This is because:</p>
<ol>
<li>Oracle doesn&#8217;t need whitespace for tokenizing the SQL statement (differences in character classes will do &#8211; as I&#8217;ve explained <a href="http://blog.tanelpoder.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2Jsb2cudGFuZWxwb2Rlci5jb20vMjAwOC8wMS8xNC9jYW4teW91LXdyaXRlLWEtd29ya2luZy1zcWwtc3RhdGVtZW50LXdpdGhvdXQtdXNpbmctYW55LXdoaXRlc3BhY2Uv" >here</a>)</li>
<li>The first from &#8220;keyword&#8221; in the above statement is broken down to two tokens as an &#8220;F&#8221; right after a digit means that the preceding number is a FLOAT (and &#8220;D&#8221; means DOUBLE) and the tokenizer stops right there, knowing that whatever comes after this character (&#8220;ROM&#8221;) is a next token, which according to the Oracle SQL syntax rules will be assigned as the output column alias</li>
</ol>
<p>The following funky-looking SQL statements are also valid:</p>
<pre>
SQL&gt; select.1e2ffrom dual;

&nbsp;&nbsp;&nbsp;&nbsp; .1E2F
----------
&nbsp; 1.0E+001

SQL&gt; select.1e2fas"."from dual;

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .
----------
&nbsp; 1.0E+001
</pre>
<p>In the upper example, the &#8220;.1e2f&#8221; means number .1 * 10^2 (scientific notation) represented as a FLOAT internally and in the lower one I&#8217;ve just added a column alias with &#8220;AS&#8221; keyword just to make the SQL look a bit crazier.</p>
<p>:-)</p>
<div class="facebook_like_button"><iframe src="http://www.facebook.com/plugins/like.php?href=http://blog.tanelpoder.com/2011/01/10/is-this-valid-sql-syntax/&amp;layout=standard&amp;show-faces=true&amp;width=450&amp;action=like&amp;font=arial&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="padding: 0px 0px; border:none; overflow:hidden; width:450px; height:70px;"></iframe></div> <img src="http://blog.tanelpoder.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=824" width="1" height="1" style="display: none;" /><p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save#url=http://blog.tanelpoder.com/2011/01/10/is-this-valid-sql-syntax/&amp;title=Is%20this%20valid%20SQL%20syntax?%20:-)"><img src="http://blog.tanelpoder.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://blog.tanelpoder.com/2011/01/10/is-this-valid-sql-syntax/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Quiz: Explaining index creation</title>
		<link>http://blog.tanelpoder.com/2010/04/23/quiz-explaining-index-creation/</link>
		<comments>http://blog.tanelpoder.com/2010/04/23/quiz-explaining-index-creation/#comments</comments>
		<pubDate>Fri, 23 Apr 2010 14:49:02 +0000</pubDate>
		<dc:creator>Tanel Poder</dc:creator>
		
		<guid isPermaLink="false">http://blog.tanelpoder.com/?p=680</guid>
		<description><![CDATA[Did you know that it&#8217;s possible to use EXPLAIN PLAN FOR CREATE INDEX ON table(col1,col2,col3) syntax for explaining what exactly would be done when an index is created? That&#8217;s useful for example for seeing the Oracle&#8217;s estimated index size without having to actually create the index. You can also use EXPLAIN PLAN FOR ALTER INDEX [...]]]></description>
			<content:encoded><![CDATA[<p>Did you know that it&#8217;s possible to use EXPLAIN PLAN FOR <strong>CREATE INDEX </strong>ON table(col1,col2,col3) syntax for explaining what exactly would be done when an index is created?</p>
<p>That&#8217;s useful for example for seeing the Oracle&#8217;s estimated index size without having to actually create the index.</p>
<p>You can also use EXPLAIN PLAN FOR <strong>ALTER INDEX</strong> i <strong>REBUILD</strong> to see whether this operation would use a FULL TABLE SCAN or a FAST FULL INDEX SCAN (offline index rebuilds of valid indexes can use this method).</p>
<p>Anyway, you can experiment with this yourself, but here&#8217;s a little quiz (with a little gotcha :)</p>
<p>What kind of index creation statement would create such an execution plan?</p>
<pre>SQL&gt; explain plan for create index hack_index on hack_table ....the rest is a secret for now....
Explained.
<span style="font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: small;"><span style="line-height: 19px; white-space: normal;"><span style="font-family: Consolas, Monaco, 'Courier New', Courier, monospace; font-size: small;"><span style="line-height: 18px; white-space: pre;">
<pre>PLAN_TABLE_OUTPUT
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Plan hash value: 457720527
-------------------------------------------------------------------------------------------------
| Id  | Operation                | Name                 | Rows  | Bytes | Cost (%CPU)| Time     |
-------------------------------------------------------------------------------------------------
|   0 | CREATE INDEX STATEMENT   |                      | 88868 |       |   657   (1)| 00:00:12 |
|   1 |  INDEX BUILD NON UNIQUE  | HACK_INDEX           |       |       |            |          |
|   2 |   SORT AGGREGATE         |                      |     1 |       |            |          |
|   3 |    VIEW                  | HACK_VIEW            | 74062 |       |   318   (1)| 00:00:06 |
|*  4 |     HASH JOIN            |                      | 74062 |  1012K|   210   (1)| 00:00:04 |
|   5 |      TABLE ACCESS FULL   | TEST_USERS           |    46 |   368 |     4   (0)| 00:00:01 |
|   6 |      INDEX FAST FULL SCAN| IDX2_INDEXED_OBJECTS | 74062 |   433K|   206   (1)| 00:00:04 |
|   7 |   SORT CREATE INDEX      |                      | 88868 |       |            |          |
|   8 |    TABLE ACCESS FULL     | HACK_TABLE           | 88868 |       |   544   (1)| 00:00:10 |
-------------------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
4 - access("U"."USERNAME"="O"."OWNER")
Note
-----
- estimated index size: 3145K bytes</pre>
<p></span></span></span></span></pre>
<div class="facebook_like_button"><iframe src="http://www.facebook.com/plugins/like.php?href=http://blog.tanelpoder.com/2010/04/23/quiz-explaining-index-creation/&amp;layout=standard&amp;show-faces=true&amp;width=450&amp;action=like&amp;font=arial&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="padding: 0px 0px; border:none; overflow:hidden; width:450px; height:70px;"></iframe></div> <img src="http://blog.tanelpoder.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=680" width="1" height="1" style="display: none;" /><p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://blog.tanelpoder.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://blog.tanelpoder.com/2010/04/23/quiz-explaining-index-creation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

