CREATE TRIGGER E_I_V_PERSONNE_PHYSIQUE
ON S_PRS.V_PERSONNE_PHYSIQUE
INSTEAD OF INSERT
FOR EACH STATEMENT
BEGIN ATOMIC
   INSERT INTO S_PRS.T_PERSONNE_GENERIQUE_PSG
   SELECT PSG_ID, COALESCE(PSG_DATE_CREATION, CURRENT_DATE)   
   FROM   new;
   INSERT INTO S_PRS.T_PERSONNE_PHYSIQUE_PSP
   SELECT PSG_ID, PSP_NOM, PSP_PRENOM, PSP_DATE_NAISSANCE
   FROM   new;
END;

/*

--> solution pour SQL Server

CREATE TRIGGER E_I_V_PERSONNE_PHYSIQUE
ON S_PRS.V_PERSONNE_PHYSIQUE
INSTEAD OF INSERT
AS
BEGIN
   INSERT INTO S_PRS.T_PERSONNE_GENERIQUE_PSG
   SELECT PSG_ID, COALESCE(PSG_DATE_CREATION, CURRENT_TIMESTAMP)   
   FROM   inserted;
   INSERT INTO S_PRS.T_PERSONNE_PHYSIQUE_PSP
   SELECT PSG_ID, PSP_NOM, PSP_PRENOM, PSP_DATE_NAISSANCE
   FROM   inserted;
END;

*/
