PostgreSQL 中的加等于运算符是什么?
What is the add equals operator in PostgreSQL?
在 Oracle SQL 中,有一个 (+)= 运算符可以添加等号。
我一直在网上搜索但无法找到 PostgreSQL 语法的等效项,PostgreSQL 中是否存在此运算符?如果没有,我将如何实现相同的功能?
提前致谢。
外部联接是 documented in PostgreSQL.
这也记录在 Oracle SQL Reference 中说:
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.
注意:在 Oracle PL/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:
:= . ( @ % ;
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>
在 Oracle SQL 中,有一个 (+)= 运算符可以添加等号。
我一直在网上搜索但无法找到 PostgreSQL 语法的等效项,PostgreSQL 中是否存在此运算符?如果没有,我将如何实现相同的功能?
提前致谢。
外部联接是 documented in PostgreSQL.
这也记录在 Oracle SQL Reference 中说:
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.
注意:在 Oracle PL/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:
:= . ( @ % ;
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>