I’ve got this simple Oracle statement for deleting rows… but I can’t get it work
delete from NPEA.tnpe00_all
where EXISTS
(select 1
from NPEA.tnpe05_doc, NPEA.tnpe00_all
where NPEA.tnpe05_doc.n_doc = NPEA.tnpe00_all.t_doc
and NPEA.tnpe05_doc.n_prt is null
and NPEA.tnpe05_doc.n_can = 4
order by n_doc)
The error code is
00907. 00000 - "missing right parenthesis"
What’s wrong with this?
You can’t use ORDER BY in an EXISTS clause:
An order by clause in a set makes no sense, hence the error (with admittedly an unhelpful message).