I can’t run a trial in Firebird

Asked

Viewed 50 times

2

Good afternoon guys. I need to enter a record in the database but no duplicates. I tried this:

create procedure My_Proc
as begin

if(not exists(select * from alunos where nome = 'Mateus')) then

insert into Alunos (Matricula, Nome, Idade, OBS) 
values (6, 'Mateus', 5, 'É terrível');

end

Does not recognize the ';' at the end of the Insert command. If I take the ';', it does not recognize the END. Someone knows what’s missing ?

I’m wearing the Flaming Robin.

NOTE: If I use the execute block, the same errors happen.

  • Thank you very much, it helped a lot, only in place of create Procedure I used a execute block. Now I understand why it has syntaxes that work in Flame Robin and do not work in my projects and vice versa. Vlw vein !

1 answer

1

Maybe the use of SET TERM (Instructions set term) solve your problem.

create procedure My_Proc
 as begin


 SET TERM  ^;

 if(not exists(select * from alunos where nome = 'Mateus')) then

 insert into Alunos (Matricula, Nome, Idade, OBS) 
 values (6, 'Mateus', 5, 'É terrível');

 end ^

Browser other questions tagged

You are not signed in. Login or sign up in order to post.