CREATE FUNCTION trigOutlaw_3() RETURNStrigger
AS $$ DECLARE nbol int; BEGIN SELECT COUNT(*) INTO nbol FROM outlaw; RAISE NOTICE '% outlaws dans la table', nbol;RETURN NULL
; END $$ LANGUAGE plpgsql; CREATE TRIGGER trigOLBEFORE
INSERT ON outlawFOR EACH ROW
EXECUTE PROCEDURE trigOutlaw_3(); DELETE FROM outlaw; INSERT INTO outlaw(ol_nom,ol_prenom,ol_naissance) SELECT etud_nom, etud_prenom, etud_naissance FROM etudiant WHERE etud_nom = 'Dalton'; SELECT * FROM outlaw;
DELETE 4
psql:fichier.sql:102: NOTICE: 0 outlaws dans la table
psql:fichier.sql:102: NOTICE: 0 outlaws dans la table
psql:fichier.sql:102: NOTICE: 0 outlaws dans la table
psql:fichier.sql:102: NOTICE: 0 outlaws dans la table
INSERT 0 0
ol_id | ol_nom | ol_prenom | ol_naissance
-------+--------+-----------+--------------
(0 rows)