ORA 00936 error while using left outer join + syntax
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 开发者_如何学Cthis SQL, I receive error ORA 00936:missing expression.
Any idea what is wrong here?
I think that you need to put the (+)
operator immediately after the column name that it applies to.
trunc(CT1,'Mi')=trunc(CT2 (+),'Mi')
"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.
Try using ANSI syntax:
T1 LEFT OUTER JOIN T2 ON TRUNC(CT1,'Mi')=TRUNC(CT2,'Mi')
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.
精彩评论