使用左外连接时出现 ORA 00936 错误 +句法
我有两个表:T1 和 T2
- T1 有一个 DATE 列:CT1
- T2 有一个 DATE 列:CT2
我想使用连接条件保留外连接 T1 和 T2:
trunc(CT1,'Mi')=trunc(CT2,'Mi')(+)
当我尝试运行此 SQL 时,收到错误 ORA 00936:missing表达。
知道这里出了什么问题吗?
I have two tables: T1 and T2
- T1 has a DATE column: CT1
- T2 has a DATE column: CT2
I want to left outer join T1 and T2 with join condition:
trunc(CT1,'Mi')=trunc(CT2,'Mi')(+)
When I try to run this SQL, I receive error ORA 00936:missing expression.
Any idea what is wrong here?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为您需要将
(+)
运算符放在它所适用的列名称之后。“(+) 运算符只能应用于一列,而不能应用于任意表达式。但是,任意表达式可以包含一个或多个标有 (+) 运算符的列。” (来自 http://download.oracle.com/docs /cd/B19306_01/server.102/b14200/queries006.htm)
无论如何,我建议使用ANSI 语法。它更清晰、更实用、更便携。
I think that you need to put the
(+)
operator immediately after the column name that it applies to."The (+) operator can be applied only to a column, not to an arbitrary expression. However, an arbitrary expression can contain one or more columns marked with the (+) operator." (from http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/queries006.htm)
In any case, I would suggest using the ANSI syntax. It's clearer, more functional, and portable.
尝试使用 ANSI 语法:
(+) 外连接语法有一些限制,这可能是其中之一。当然,如果您更改此连接,则必须更改所有这些连接 - 不能混合两者。
Try using ANSI syntax:
The (+) outer join syntax has some limitations, this could be one of them. Of course, if you change this join, you'll have to change them all - you can't mix the two.