ORA-00907:缺少右括号

时间:2019-11-10 02:04:30

标签: oracle oracle11g

SELECT S.sname FROM Suppliers S
WHERE NOT EXISTS (( SELECT P.pid FROM Parts P )
EXCEPT
( SELECT C.pid FROM Catalog C
WHERE C.sid = S.sid ))

当我执行它时,它会显示一条错误消息,提示缺少右括号。

1 个答案:

答案 0 :(得分:3)

Oracle不知道EXCEPT。设置的负运算符在此处称为MINUS

您也不需要内部括号。但是它们也没有害处。

SELECT s.sname
       FROM suppliers S
       WHERE NOT EXISTS (SELECT p.pid
                                FROM parts P 
                         MINUS
                         SELECT c.pid
                                FROM catalog c
                                WHERE c.sid = s.sid);