I’m talking about this:
select-1from from dual;
Looks like invalid, right? Well, let’s run it:
SQL> select-1from from dual; ROM ---------- -1.0E+000
This is because:
- Oracle doesn’t need whitespace for tokenizing the SQL statement (differences in character classes will do – as I’ve explained here)
- The first from “keyword” in the above statement is broken down to two tokens as an “F” right after a digit means that the preceding number is a FLOAT (and “D” means DOUBLE) and the tokenizer stops right there, knowing that whatever comes after this character (“ROM”) is a next token, which according to the Oracle SQL syntax rules will be assigned as the output column alias
The following funky-looking SQL statements are also valid:
SQL> select.1e2ffrom dual; .1E2F ---------- 1.0E+001 SQL> select.1e2fas"."from dual; . ---------- 1.0E+001
In the upper example, the “.1e2f” means number .1 * 10^2 (scientific notation) represented as a FLOAT internally and in the lower one I’ve just added a column alias with “AS” keyword just to make the SQL look a bit crazier.
NB! After a 1.5 year break, this year’s only Advanced Oracle Troubleshooting training class (updated with Oracle 12c content) takes place on 16-20 November & 14-18 December 2015, so sign up now if you plan to attend this year!