1

In Oracle SQL, there is an (+)= operator that adds equals.

I have been searching online but have been unable to find the equivalent for PostgreSQL syntax, does this operator exist in PostgreSQL? If not, how would I go about achieving the same functionality?

Thank you in advance.

Chad
  • 99
  • 7
  • If you do mean Oracle's older outer join syntax then @pifor is correct. But you didn't mention join so perhaps you have another construct in mind. Let J=1, K=3, now J+=K and J is then 4? Well there is no such operator in Postgres, just plan old J=J+K. – Belayer Apr 14 '20 at 16:35

1 Answers1

1

OUTER JOIN is documented in PostgreSQL.

This is also documented in Oracle SQL Reference which says:

Oracle recommends that you use the FROM clause OUTER JOIN syntax rather than the Oracle join operator. Outer join queries that use the Oracle join operator (+) are subject to the following rules and restrictions, which do not apply to the FROM clause OUTER JOIN syntax:

You cannot specify the (+) operator in a query block that also contains FROM clause join syntax.

The (+) operator can appear only in the WHERE clause or, in the context of left-correlation (when specifying the TABLE clause) in the FROM clause, and can be applied only to a column of a table or view.

If A and B are joined by multiple join conditions, then you must use the (+) operator in all of these conditions. If you do not, then Oracle Database will return only the rows resulting from a simple join, but without a warning or error to advise you that you do not have the results of an outer join.

The (+) operator does not produce an outer join if you specify one table in the outer query and the other table in an inner query.

NB: in Oracle PL/SQL there is neither += nor +:= operator:

SQL> declare
  2  i numeric := 0;
  3  begin
  4   i+:=1;
  5  end;
  6  /
 i+:=1;
  *
ERROR at line 4:
ORA-06550: line 4, column 3:
PLS-00103: Encountered the symbol "+" when expecting one of the following:
:= . ( @ % ;
The symbol "+" was ignored.


SQL> --
SQL> declare
  2  i numeric := 0;
  3  begin
  4   i+=1;
  5  end;
  6  /
 i+=1;
  *
ERROR at line 4:
ORA-06550: line 4, column 3:
PLS-00103: Encountered the symbol "+" when expecting one of the following:
:= . ( @ % ;


SQL> show errors
No errors.
SQL> --
SQL> declare
  2  i numeric := 0;
  3  begin
  4   i := i + 1;
  5  end;
  6  /

PL/SQL procedure successfully completed.

SQL> 
pifor
  • 7,419
  • 2
  • 8
  • 16