Reputation: 5
create trigger tr_af after update on relatorio_notas
for each row
if (new.Nota < 7) then
insert into aluno_af (nome, matricula) values (new.Nota, new.Matricula_estudante)
end if;
I got syntax error and I don't know why
Upvotes: 0
Views: 54
Reputation: 289535
You need a BEGIN
and END
block in your syntax. See the 13.1.11 CREATE TRIGGER Syntax:
create trigger tr_af after update on relatorio_notas
for each row
begin # <-------------------
if (new.Nota < 7) then
insert into aluno_af (nome, matricula) values (new.Nota, new.Matricula_estudante);
end if;
end # <-------------------
Note you may need to set the delimiter to something different than ;
.
See more info in MySQL syntax check or a sample in Trigger syntax and IF ELSE THEN.
Upvotes: 1