Results 1 to 1 of 1
Thread: What does this MySQL trigger do?
Feb 8, 2010, 13:52 #1
What does this MySQL trigger do?
I have two versions of the same DB. The original has code for triggers. The second is a copy of the original without the triggers.
With the original DB, the application fails to post data on submit, but data seems to post correctly to the copy.
Here's the trigger code:
DROP TRIGGER IF EXISTS `uat`.`updateConditionCCRDataObjectID`; DELIMITER // CREATE TRIGGER `uat`.`updateConditionCCRDataObjectID` BEFORE INSERT ON `uat`.`condition_details` FOR EACH ROW BEGIN IF NEW.CCRDataObjectID = NULL OR NEW.CCRDataObjectID = '' THEN SELECT coalesce(MAX(id)+1,1) into @IDVal from condition_details; SET NEW.CCRDataObjectID = CONCAT('Comp-Condition-',@IDVal); END IF; END // DELIMITER ;
Thanks - Steve