MySQL Forums
Forum List  »  Triggers

create trigger + if-statement
Posted by: Tyas Seegers
Date: May 26, 2008 04:14AM

Hello

I have a problem with creating triggers. All the syntax that is online about triggers doesn't work for me.

The following trigger doesn't work(gives error #1064 - You have an error in your SQL syntax):
create trigger test
After Delete
ON land
for each row
Begin
insert into land (landnaam) values ('Griekenland');
End;

The same trigger without begin & end does work:
create trigger test
After Delete
ON land
for each row
insert into land (landnaam) values ('Griekenland');

But when I want to put a if-statement in my trigger i get error #1064 again
Example:

create trigger test
After Delete
ON land
for each row
if(1=1) then
insert into land (landnaam) values ('Griekenland');
end if;


I've tried to make this triggers on MySQL client version: 4.1.22 and on 5.0.37
I'm using the engine: INNODB
Can someone please help me?

Options: ReplyQuote


Subject
Views
Written By
Posted
create trigger + if-statement
8320
May 26, 2008 04:14AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.