I'm trying to create this trigger
in SQLite
, but I do not know if it's possible.
I have a tabea Remedios
and a Manutenção
. I want, when I have an insert in the Manutenção
table, it does an update depending on the condition in Case
, but it is giving error in Update
.
CREATE TRIGGER TGmovimentacao
AFTER INSERT
ON manutencao
for each row
BEGIN
Select Case
When ( NEW.tpMov = 'S' )
then UPDATE Remedio set Remedio.RemedioDose = Remedio.RemedioDose - NEW.qtdDose where Remedio.idRemedio = NEW.idManutencao
END;
END;