This trigger updates the cost of an article in the articulo table after an insert or update occurs on the entrada table. It refers to the old and new rows as OLD and NEW. For each row affected, it updates the costo column in the articulo table to match the new cost in the entrada table where the idarticulo columns are equal.
1 of 1
Download to read offline
More Related Content
Sintaxi sdisparador triger
1. create or replace
TRIGGER "TG_COSTO"
AFTER INSERT OR UPDATE ON ENTRADA
REFERENCING OLD AS OLD NEW AS NEW
FOR EACH ROW
DECLARE
BEGIN
UPDATE ARTICULO SET COSTO=:NEW.COSTO
WHERE IdArticulo=:new.idarticulo;
END;