<?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: Name that Table&#8217;s Column</title>
	<atom:link href="http://hoopercharles.wordpress.com/2012/11/09/name-that-tables-column/feed/" rel="self" type="application/rss+xml" />
	<link>http://hoopercharles.wordpress.com/2012/11/09/name-that-tables-column/</link>
	<description>Miscellaneous Random Oracle Topics: Stop, Think, ... Understand</description>
	<lastBuildDate>Thu, 13 Jun 2013 22:46:43 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: stebradshaw</title>
		<link>http://hoopercharles.wordpress.com/2012/11/09/name-that-tables-column/#comment-5048</link>
		<dc:creator><![CDATA[stebradshaw]]></dc:creator>
		<pubDate>Wed, 28 Nov 2012 15:27:03 +0000</pubDate>
		<guid isPermaLink="false">http://hoopercharles.wordpress.com/?p=6740#comment-5048</guid>
		<description><![CDATA[I hadn&#039;t even considered a reserved word as a column name, thats not good!

I found about USER  table in an application originally developed against MySQL that has since had Oracle support added.]]></description>
		<content:encoded><![CDATA[<p>I hadn&#8217;t even considered a reserved word as a column name, thats not good!</p>
<p>I found about USER  table in an application originally developed against MySQL that has since had Oracle support added.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Charles Hooper</title>
		<link>http://hoopercharles.wordpress.com/2012/11/09/name-that-tables-column/#comment-5047</link>
		<dc:creator><![CDATA[Charles Hooper]]></dc:creator>
		<pubDate>Wed, 28 Nov 2012 14:10:43 +0000</pubDate>
		<guid isPermaLink="false">http://hoopercharles.wordpress.com/?p=6740#comment-5047</guid>
		<description><![CDATA[Yes, that is a bit of a potential headache in the making.  

Along the same lines:
&lt;pre&gt;
CREATE TABLE T1(
  &quot;USER&quot; VARCHAR2(30),
  C2 VARCHAR2(30) DEFAULT USER);
. 
SELECT
  USER
FROM
  T1;
. 
no rows selected
. 
INSERT INTO T1(&quot;USER&quot;) VALUES (&#039;HOOPER&#039;);
. 
SELECT
  USER
FROM
  T1;
. 
USER
------------------------------
TESTUSER
. 
SELECT
  USER,
  &quot;USER&quot;
FROM
  T1;
. 
USER                           USER
------------------------------ ------------------------------
TESTUSER                       HOOPER
&lt;/pre&gt;
 
Now, let&#039;s create our own USER function to see if we can make things worse:
&lt;pre&gt;
CREATE OR REPLACE FUNCTION &quot;USER&quot; RETURN VARCHAR2 IS 
  BEGIN
    RETURN &#039;CHARLES&#039;;
  END &quot;USER&quot;;
/
.  
Function created.
. 
COLUMN USER FORMAT A15
. 
SELECT
  USER,
  &quot;USER&quot;
FROM
  T1;
. 
USER            USER
--------------- ---------------
TESTUSER        HOOPER
. 
SELECT
  TESTUSER.&quot;USER&quot;,
  &quot;USER&quot;,
  USER
FROM
  T1;
. 
USER            USER            USER
--------------- --------------- ---------------
CHARLES         HOOPER          TESTUSER
&lt;/pre&gt;
 
Now introduce a public synonym:
&lt;pre&gt;
CREATE PUBLIC SYNONYM &quot;USER&quot; FOR TESTUSER.&quot;USER&quot;;
. 
Synonym created.
. 
SELECT
  USER,
  &quot;USER&quot;
FROM
  T1;
. 
USER            USER
--------------- ---------------
TESTUSER        HOOPER
. 
SELECT
  USER,
  &quot;USER&quot;
FROM
  DUAL;
. 
USER            USER
--------------- ---------------
TESTUSER        CHARLES
. 
DROP PUBLIC SYNONYM &quot;USER&quot;;
. 
Synonym dropped.
. 
SELECT
  USER,
  &quot;USER&quot;
FROM
  DUAL;
. 
USER            USER
--------------- ---------------
TESTUSER        CHARLES
&lt;/pre&gt;
 
Now to clean up the last of the mess:
&lt;pre&gt;
DROP FUNCTION &quot;USER&quot;;
. 
Function dropped.
. 
SELECT
  USER,
  &quot;USER&quot;
FROM
  DUAL;
. 
  *
ERROR at line 3:
ORA-00904: &quot;USER&quot;: invalid identifier
. 
DROP TABLE T1 PURGE;
. 
Table dropped.
&lt;/pre&gt;
 
Precedence (and context)... the same excuse why &lt;b&gt;(1 + 1 * 2)&lt;/b&gt; is equal to 3 and not 4.

&lt;i&gt;(Edit:Workpress for some reason is now removing lines with a single space from pre formatted comment sections, so I added a . character at the start of those lines for additional readability).&lt;/i&gt;]]></description>
		<content:encoded><![CDATA[<p>Yes, that is a bit of a potential headache in the making.  </p>
<p>Along the same lines:</p>
<pre>
CREATE TABLE T1(
  "USER" VARCHAR2(30),
  C2 VARCHAR2(30) DEFAULT USER);
. 
SELECT
  USER
FROM
  T1;
. 
no rows selected
. 
INSERT INTO T1("USER") VALUES ('HOOPER');
. 
SELECT
  USER
FROM
  T1;
. 
USER
------------------------------
TESTUSER
. 
SELECT
  USER,
  "USER"
FROM
  T1;
. 
USER                           USER
------------------------------ ------------------------------
TESTUSER                       HOOPER
</pre>
<p>Now, let&#8217;s create our own USER function to see if we can make things worse:</p>
<pre>
CREATE OR REPLACE FUNCTION "USER" RETURN VARCHAR2 IS 
  BEGIN
    RETURN 'CHARLES';
  END "USER";
/
.  
Function created.
. 
COLUMN USER FORMAT A15
. 
SELECT
  USER,
  "USER"
FROM
  T1;
. 
USER            USER
--------------- ---------------
TESTUSER        HOOPER
. 
SELECT
  TESTUSER."USER",
  "USER",
  USER
FROM
  T1;
. 
USER            USER            USER
--------------- --------------- ---------------
CHARLES         HOOPER          TESTUSER
</pre>
<p>Now introduce a public synonym:</p>
<pre>
CREATE PUBLIC SYNONYM "USER" FOR TESTUSER."USER";
. 
Synonym created.
. 
SELECT
  USER,
  "USER"
FROM
  T1;
. 
USER            USER
--------------- ---------------
TESTUSER        HOOPER
. 
SELECT
  USER,
  "USER"
FROM
  DUAL;
. 
USER            USER
--------------- ---------------
TESTUSER        CHARLES
. 
DROP PUBLIC SYNONYM "USER";
. 
Synonym dropped.
. 
SELECT
  USER,
  "USER"
FROM
  DUAL;
. 
USER            USER
--------------- ---------------
TESTUSER        CHARLES
</pre>
<p>Now to clean up the last of the mess:</p>
<pre>
DROP FUNCTION "USER";
. 
Function dropped.
. 
SELECT
  USER,
  "USER"
FROM
  DUAL;
. 
  *
ERROR at line 3:
ORA-00904: "USER": invalid identifier
. 
DROP TABLE T1 PURGE;
. 
Table dropped.
</pre>
<p>Precedence (and context)&#8230; the same excuse why <b>(1 + 1 * 2)</b> is equal to 3 and not 4.</p>
<p><i>(Edit:Workpress for some reason is now removing lines with a single space from pre formatted comment sections, so I added a . character at the start of those lines for additional readability).</i></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: stebradshaw</title>
		<link>http://hoopercharles.wordpress.com/2012/11/09/name-that-tables-column/#comment-5045</link>
		<dc:creator><![CDATA[stebradshaw]]></dc:creator>
		<pubDate>Mon, 26 Nov 2012 10:56:11 +0000</pubDate>
		<guid isPermaLink="false">http://hoopercharles.wordpress.com/?p=6740#comment-5045</guid>
		<description><![CDATA[It gets even messier...its possible to create tables with the same name as reserved words:

SQL&gt; select * from user ;
select * from user
              *
ERROR at line 1:
ORA-00903: invalid table name
 
SQL&gt; create table &quot;USER&quot; (n number) ;
 
Table created.
 
SQL&gt; insert into &quot;USER&quot; values (1) ;
 
1 row created.
 
SQL&gt; select * from user
  2  /
select * from user
              *
ERROR at line 1:
ORA-00903: invalid table name
 
SQL&gt; select * from USER ;
select * from USER
              *
ERROR at line 1:
ORA-00903: invalid table name
 
SQL&gt; select * from &quot;USER&quot; ;
 
         N
----------
         1]]></description>
		<content:encoded><![CDATA[<p>It gets even messier&#8230;its possible to create tables with the same name as reserved words:</p>
<p>SQL&gt; select * from user ;<br />
select * from user<br />
              *<br />
ERROR at line 1:<br />
ORA-00903: invalid table name</p>
<p>SQL&gt; create table &#8220;USER&#8221; (n number) ;</p>
<p>Table created.</p>
<p>SQL&gt; insert into &#8220;USER&#8221; values (1) ;</p>
<p>1 row created.</p>
<p>SQL&gt; select * from user<br />
  2  /<br />
select * from user<br />
              *<br />
ERROR at line 1:<br />
ORA-00903: invalid table name</p>
<p>SQL&gt; select * from USER ;<br />
select * from USER<br />
              *<br />
ERROR at line 1:<br />
ORA-00903: invalid table name</p>
<p>SQL&gt; select * from &#8220;USER&#8221; ;</p>
<p>         N<br />
&#8212;&#8212;&#8212;-<br />
         1</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Yes, these really are different columns &#187; SQLfail</title>
		<link>http://hoopercharles.wordpress.com/2012/11/09/name-that-tables-column/#comment-5037</link>
		<dc:creator><![CDATA[Yes, these really are different columns &#187; SQLfail]]></dc:creator>
		<pubDate>Wed, 21 Nov 2012 09:00:46 +0000</pubDate>
		<guid isPermaLink="false">http://hoopercharles.wordpress.com/?p=6740#comment-5037</guid>
		<description><![CDATA[[...] to a post from Charles Hooper and the ever brilliant Life of Brian for providing inspiration for [...]]]></description>
		<content:encoded><![CDATA[<p>[...] to a post from Charles Hooper and the ever brilliant Life of Brian for providing inspiration for [...]</p>
]]></content:encoded>
	</item>
</channel>
</rss>
