I am trying to execute the query below:
UPDATE(
SELECT Ord.Completed
FROM Product P
INNER JOIN Order1 Ord
ON Ord.OrderID = P.OrderID
WHERE EXISTS(
SELECT *
FROM Delivery D
WHERE Delivery.Delivered = 0 AND P.ProductID = Delivery.DeliveryID
)
)
SET Completed= 'NO';
If I run the SELECT part only, without UPDATE it returns the right results. When I try to execute the UPDATE query I get
"ORA-00933: SQL command not properly ended
00933. 00000 - "SQL command not properly ended"
*Cause:
*Action:
Error at Line: 2 Column: 250"
Any ideas?
SET Completed= 'YES' ;
(remove the table name from that part);
). Not sure. But please answer the above question, I'm not sure your approach is correct.;
) too. An order has several products, some delivered and some other not. I add the Completed attribute to the Order table the 'YES' as the default value. An order is Completed when all its products are delivered. If I remove the UPDATE clause, the SELECT returns the correct results, that is, the Orders that contains products not delivered. I cannot understand why that's not work for the UPDATE