开发者

Sanity Check: (+) Operator in WHERE Clause for Oracle DB? [duplicate]

开发者 https://www.devze.com 2023-02-16 16:04 出处:网络
This question already has answers here: Closed 11 years ago. Possible Duplicate: Oracle “(+)” Operator
This question already has answers here: Closed 11 years ago.

Possible Duplicate:

Oracle “(+)” Operator

So I was given a script with the followin开发者_开发知识库g:

SELECT BLAH
  FROM A_TABLE T1, A_TABLE T2, A_TABLE T3 
 WHERE T2.FIELD_1(+) = T1.FIELD_1
   AND T3.FIELD_1(+) = T2.FIELD_1
   ... etc a few more AND clauses that do that same thing

I need to convert this script to MSSQL Server but I have no clue what this operator is doing. Is it possible that this is some kind of typo?


That's the old Oracle syntax for outer joins. You should use the ANSI join syntax instead:

SELECT BLAH
  FROM A_TABLE T1
  LEFT JOIN A_TABLE T2 ON T2.FIELD_1 = T1.FIELD_1
  LEFT JOIN A_TABLE T3 ON T3.FIELD_1 = T2.FIELD_1
 WHERE ... etc


It is the Oracle notation for LEFT JOIN.

It means

SELECT BLAH
  FROM A_TABLE T1
  LEFT JOIN A_TABLE T2 ON T2.FIELD_1 = T1.FIELD_1
  LEFT JOIN A_TABLE T3 ON T3.FIELD_1 = T2.FIELD_1
   ... etc a few more AND clauses that do that same thing

The (+) is put against the optional side. Read also:

  • http://www.dba-oracle.com/art_sql_iso_99.htm
  • Difference between Oracle's plus (+) notation and ansi JOIN notation?
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号