Du kan gøre dette i to trin:
CREATE OR REPLACE TRIGGER trg_stock_ai AFTER INSERT OR UPDATE ON sale
FOR EACH ROW
BEGIN
UPDATE product
SET qty_stock = (qty_stock - :NEW.sale_p_qty)
WHERE p.product_id = :NEW.product_id;
UPDATE product
SET qty_stock = (qty_stock + :OLD.sale_p_qty)
WHERE p.product_id = :OLD.product_id;
END;
Dette burde fungere for både indsættelser og opdateringer, selv når product_id
ændringer.