Reputation: 594
Here is my query:
SELECT s.sname,
s.deptid
FROM student s
WHERE NOT EXISTS ((SELECT *
FROM class c)
EXCEPT
(SELECT c1.room
FROM class c1,
enrolled e
WHERE s.snum = e.snum
AND e.cname LIKE c1.cname))
GROUP BY s.sname,
s.deptid;
My error is
EXCEPT
*
ERROR at line 5:
ORA-00907: missing right parenthesis
Not sure why as I seem to have the right amount of left and right parenthesis. I've tried moving everything to the where not exists line but get the same error.
Upvotes: 0
Views: 755
Reputation: 48111
Since you have tagged this sqlplus
I assume you're using Oracle. The EXCEPT
keyword does not exist in Oracle; the equivalent is MINUS
. I think in this case the parser is seeing EXCEPT
as an alias for the subquery preceding it, then expecting the parenthetical expression to be closed.
Try replacing EXCEPT
with MINUS
and see what result you get. There could still be other syntax errors, the nesting is a little hard to follow.
Upvotes: 3