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! I am running one more Advanced Oracle Troubleshooting training in 2018! You can attend the live online training and can download personal video recordings too. The Part 1 starts on 29th January 2018 - sign up here!