Re: Things I didn't know about Oracle column aliases

From: Jonathan Lewis <jonathan_at_jlcomp.demon.co.uk>
Date: Wed, 14 Dec 2011 10:38:05 -0000
Message-ID: <82D60EC9F2B549F98DA14A0458A30594_at_Primary>


I think Tanel Poder wrote a blog note some time ago about the way Oracle tokenizes text incrementally in a way that let's you get away with omitting spaces, but sometimes surprises you. The 123456789FA can be explained by this - Oracle keeps reading until tokenization fails, so it reads up to the F and finds that the A would cause a tokenization error, so it stops at the F. The next token is therefore the A - which is legal if it is treated as a column alias.

(Found the reference:
http://blog.tanelpoder.com/2011/01/10/is-this-valid-sql-syntax/)

Regards

Jonathan Lewis
http://jonathanlewis.wordpress.com
Oracle Core:
http://www.apress.com/9781430239543

  • Original Message ----- From: "Norman Dunbar" <oracle_at_dunbar-it.co.uk> To: <oracle-l_at_freelists.org> Sent: Wednesday, December 14, 2011 9:44 AM Subject: Things I didn't know about Oracle column aliases

I knew you could do this:

SQL> select 1234567890 as abc from dual;

        ABC



1234567890
--
http://www.freelists.org/webpage/oracle-l
Received on Wed Dec 14 2011 - 04:38:05 CST

Original text of this message