在 Oracle “AS"中别名不起作用

2021-12-30 00:00:00 oracle11g oracle

只是想知道为什么 Oracle 不允许在查询中使用AS"别名.在我的项目中,我返回的所有查询都有别名关键字AS".

Just want to know why Oracle not allowed "AS" alias in Query. In My project all queries which i returned have alias keyword "AS".

例如;

Select t1.id,t2.name from Table1 As t1 ,Table2 t2 
on
  t1.id =t2.id

上述查询在所有服务器(如 PostgreSQL、Microsoft SQL 服务器)中运行,但在 Oracle 中不工作由于别名As"而显示错误命令不存在".如果我删除它就会运行.

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.

只是想知道为什么 Oracle Server 会这样?我想使用AS"别名运行查询.

just want to know why Oracle Server behave like this ? i want to run query using "AS"alias name.

推荐答案

虽然 Oracle 允许您在定义列别名时使用 AS,但它不允许您使用 AScode> 定义表别名时.这就是 Oracle 的工作方式.

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.

相关文章