Last active
September 17, 2017 01:22
-
-
Save jeffgerhard/334dc417f634e791ba0bdb1a07a92d95 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE DEFINER=`root`@`localhost` trigger processtrigger after INSERT ON digitization_process | |
for each row BEGIN | |
UPDATE item | |
SET | |
item.PhysicalState = (SELECT | |
NewPhysState | |
FROM | |
process_type p | |
WHERE | |
NEW.ProcessType = p.ProcessTypeID) | |
WHERE | |
itemid = NEW.ItemID | |
AND (SELECT | |
NewPhysState | |
FROM | |
process_type p | |
WHERE | |
NEW.ProcessType = p.ProcessTypeID) IS NOT NULL; | |
UPDATE item | |
SET | |
item.DigitalState = (SELECT | |
NewDigState | |
FROM | |
process_type p | |
WHERE | |
NEW.ProcessType = p.ProcessTypeID) | |
WHERE | |
itemid = NEW.ItemID | |
AND (SELECT | |
NewDigState | |
FROM | |
process_type p | |
WHERE | |
NEW.ProcessType = p.ProcessTypeID) IS NOT NULL; | |
END |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment