问题
Just want to know why Oracle not allowed "AS" alias in Query. In My project all queries which i returned have alias keyword "AS".
For.eg;
Select t1.id,t2.name from Table1 As t1 ,Table2 t2
on
t1.id =t2.id
above Query run in all Server like PostgreSQL ,Microsoft SQL server but in Oracle its Not working showing error "Command does not exists" because of alias "As". If i remove then it will run.
just want to know why Oracle Server behave like this ? i want to run query using "AS"alias name.
回答1:
While Oracle allows you to use AS when defining column aliases, it doesn't allow you to use AS when defining table aliases. It's just how Oracle works.
回答2:
You can use as(optional) for alias in column names but not for table. Using as in aliases is Microsoft standard, while ORACLE supports ANSI SQL syntax which using as in aliases is not a standard.
回答3:
According to this and this this it should be part of the ISO SQL92. Maybe Oracle did not implement it because of backward compatibility.
In Oracle keywords like "AS", "JOIN", "COMMIT", "MODEL" still can be used as object names. So you can write something like:
select J.COMMIT AS
from JOIN J;
This will select column named "COMMIT" from table named "JOIN" and the column will be aliased to "AS".
来源:https://stackoverflow.com/questions/33643163/in-oracle-as-alias-not-working