Based on what you suggested, I tried this, and I'm getting a whole bunch of errors. I don't know what else to do. I declared both price and cost at the top, and I still get errors. This is what I did:
DECLARE
myprod PRODUCTS.PRICE%TYPE;
mycost ODETAISL.COST%TYPE;
BEGIN
UPDATE ODETAILS
SET COST = (SELECT QTY * PRICE
FROM ORDERS, PRODUCTS, ODETAILS
WHERE PRODUCTS.PNO = ODETAILS.PNO AND ORDERS.ONO = ODETAILS.ONO);
END;
/
Quote:
Originally posted by LKBrwn_DBA
This looks kinda like homework, but what the heck, try this better:
UPDATE ODETAILS
SET COST = (
SELECT QTY * PRICE
FROM ORDERS, PRODUCTS
WHERE PRODUCTS.PNO = ODETAILS.PNO
AND ORDERS.ONO = ODETAILS.ONO );
|