MySQL Forums
Forum List  »  Newbie

Trigger If Statement
Posted by: Jordan Johnson
Date: January 16, 2011 01:23AM

So I'm trying to create an IF statement within my fancy new trigger, but mySQL really isn't very happy about it.


delimiter |
CREATE TRIGGER addCorp BEFORE UPDATE ON characters
FOR EACH ROW
BEGIN
IF NEW.corporationID != NULL THEN
INSERT INTO corporations SET corporationID = NEW.corporationID ON DUPLICATE KEY UPDATE corporationID = corporationID;
END IF;
END;
|
delimiter ;


Anyone have some hints as to how to make this work?

Thanks!



Edited 1 time(s). Last edit at 01/16/2011 01:24AM by Jordan Johnson.

Options: ReplyQuote


Subject
Written By
Posted
Trigger If Statement
January 16, 2011 01:23AM
January 16, 2011 01:28AM


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.