TGD/practicas/prac2/08_view_insert_trigger.sql
Carlos Galindo 7e26615aa7
Practica 2
2018-10-14 12:52:33 +02:00

12 lines
No EOL
386 B
SQL

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';