ORA-30563: outer join operator (+) not allowed in select-list, CONNECT BY, or START WITH
Cause: An attempt was made to reference (+) in select-list, CONNECT BY clause, or START WITH clause.
Action: Do not use the operator in select-list, CONNECT BY clause, or START WITH clause.
当程序员试图在SELECT列表,CONNECT BY或START WITH子句中使用带有外连接操作符(+)的列时,就会出现ORA-30563错误。
在SQL语句中,外连接操作符用于建立从一个表到另一个表的连接,但是本身是不能被用作SELECT列表,CONNECT BY或START WITH子句的。
使用外连接运算符(+)的列不能用于SELECT列表,CONNECT BY或START WITH子句。外连接的结果应该在WHERE子句中作为表达式指定。
例如,以下SQL语句会产生ORA-30563错误:
SELECT e.last_name, d.department_name
FROM employees e, departments d
WHERE e.department_id = d.department_id (+)
要解决此问题,必须分离外连接子句,将其放在WHERE子句中,而不是SELECT子句中获取每列值。
例如,可以更新该语句,如下所示:
SELECT e.last_name, d.department_name
FROM employees e, departments d
WHERE e.department_id = d.department_id (+)
AND d.department_name = ‘IT’;