bonjour tout le monde, je veux annuler l'insertion d'une ligne à partir d'un trigger s'il existe déjà,ceci grâce à un trigger,voici mon code :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 create trigger pointage_before_insert before insert on pointage for each row begin set @IdUtilisateur=new.IdUtilisateur set @DatePointage=new.DatePointage set @HeurePointage=new.HeurPointage if (select count(*)from pointage where pointage.IdUtilisateur=@IdUtilisateur and pointage.DatePointage=@DatePointage and pointage.DatePointage =@DatePointage and pointage.HeurePointage=@HeurePointage )>0 then rollback transaction end end
mais j'ai une erreur :
Error Code: 1064. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'set @DatePointage=new.DatePointage
set @HeurePointage=new.HeurPoint' at line 6
Partager