TriggerEjercicio.sql 519 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19

create function tr_OldInventory() returns Trigger 
as 
$$
begin
insert into registro_inventory(inventory_id , film_id , store_id , fecha) 
values (old.inventory_id, old.film_id , old.store_id , old.last_update);
return new;
end
$$
language plpgsql;

create trigger inventory_update after update on inventory 
for each row execute procedure tr_OldInventory();

update inventory set film_id=2 where inventory_id=2
/*Comprobacion del UPDATE*/
select * from inventory where inventory_id=2
select * from registro_inventory