List:General Discussion« Previous MessageNext Message »
From:Patrick Aljord Date:October 7 2006 2:23pm
Subject:need help on before insert trigger
View as plain text  
I would like to prohibit the value 'xxx' on my column title, and if it
does contain the value I would like to create an exception by
assigning 'xxx' to the primary key id which is int(5).
This is what I do but I get an error on its  creation so I guess it's
not the right way:
CREATE TRIGGER testref BEFORE INSERT ON bookmarks
  FOR EACH ROW
 BEGIN
 if NEW.title like '%xxx%'
  set NEW.id='xxx';
  END;

the error:
server version for the right syntax to use near ':
   set NEW.id='xxx' at line 4

any idea how to do that?

thanx in advance

pat
Thread
need help on before insert triggerPatrick Aljord7 Oct
  • Re: need help on before insert triggerPaul DuBois7 Oct
  • Re: need help on before insert triggerMark Leith7 Oct
Re: need help on before insert triggerPatrick Aljord7 Oct
Re: need help on before insert triggerPatrick Aljord7 Oct
  • Re: need help on before insert triggerPatrick Aljord7 Oct