mandroid
mandroid

Reputation: 2328

What does (+) do in Oracle SQL?

I'm using Oracle SQL Developer to query an Oracle DB (not sure which version it is) and I'm going to use the SQL I make for a Crystal report. Many of the reports the previous developers have written don't use JOIN keywords to make the joins (and I'm not too familiar with JOIN keywords as a result).

Many of the joins they make are made in the WHERE statement. I'll notice something like this.

Select * From TableA, TableB WHERE TableA.PrimaryKey(+) = TableB.ForeignKey

My question is concerning the (+). What purpose does it serve and how do I use it in my code?

Upvotes: 5

Views: 3931

Answers (4)

pravin kottawar
pravin kottawar

Reputation: 25

(+) is used to perform right outer join in Oracle RIGHT OUTER JOIN is one of the JOIN operations that allow you to specify a JOIN clause For details http://docs.oracle.com/javadb/10.8.3.0/ref/rrefsqlj57522.html

Upvotes: 0

Michael Todd
Michael Todd

Reputation: 17051

That represents a “right outer join” (right because the = is on the right side of the +).

SELECT *
FROM TableA, TableB
WHERE TableA.PrimaryKey(+) = TableB.ForeignKey

is equivalent to

SELECT *
FROM TableA
RIGHT OUTER JOIN TableB
  ON (TableA.PrimaryKey = TableB.ForeignKey)

Upvotes: 8

softveda
softveda

Reputation: 11066

right outer join

Upvotes: 3

BobbyShaftoe
BobbyShaftoe

Reputation: 28499

It is not recommended. See this previous answer

Difference between Oracle's plus (+) notation and ansi JOIN notation?

Upvotes: 8

Related Questions