TGD/practicas/prac2/08_view_insert_trigger.sql

12 lines
386 B
MySQL
Raw Normal View History

2018-10-14 12:52:33 +02:00
CREATE OR REPLACE TRIGGER prof_dsic_insert_trigger
INSTEAD OF INSERT ON prof_dsic
FOR EACH ROW
BEGIN
INSERT INTO profesor VALUES (:NEW.cod_pro, :NEW.nombre, :NEW.telefono, 'DSIC');
END;
/
-- Probar disparador (ver insercion antes y despues)
INSERT INTO prof_dsic VALUES ('pp', 'Pepe', '963123123');
DELETE FROM prof_dsic WHERE cod_pro = 'pp';
DELETE FROM profesor WHERE cod_pro = 'pp';