It keeps saying : ORA-00933: SQL command not properly ended
Pls help me or give me a link to a solution
UPDATE emprunts
SET etat = 'RE'
FROM emprunts A
JOIN detailsemprunts B
ON A.numero = B.emprunt
WHERE B.rendule is not null;```
It keeps saying : ORA-00933: SQL command not properly ended
Pls help me or give me a link to a solution
UPDATE emprunts
SET etat = 'RE'
FROM emprunts A
JOIN detailsemprunts B
ON A.numero = B.emprunt
WHERE B.rendule is not null;```
You can use a correlated subquery instead:
update emprunts e
set etat = 'etat'
where exists (
select 1
from detailsemprunts de
where e.numero = de.emprunts and de.rendule is not null
)
Oracle does not support FROM
in UPDATE
s. Although you could do this in a MERGE
, I think an UPDATE
with EXISTS
is much more sensible:
UPDATE emprunts e
SET etat = 'etat'
WHERE EXISTS (SELECT 1
FROM detailsemprunts de
WHERE e.numero = de.emprunts AND de.rendule is not null
);