3
I’m trying to create this trigger
in the SQLite
, but I don’t know if it’s possible.
I got a big one Remedios
and a Manutenção
. I want that when I have an insert in the table Manutenção
, it does an update depending on the condition on Case
, but is making a mistake 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;
What’s the mistake?...
– Androiderson
then, in Sqlite Studio it will underline red Update forward.
– Joel Messias Do Nascimento
in Android Studio, tbm says that the error is next to Update
– Joel Messias Do Nascimento
So it’s syntax error. You can’t execute an instruction after the
Then
, just return values. Look here for example– Androiderson