Created
December 19, 2013 19:46
-
-
Save bendem/8045032 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
-- ---------------------------------------------- | |
-- @Author: bendem | |
-- @Date: 2013-12-16 08:24:05 | |
-- @Last Modified by: bendem | |
-- @Last Modified time: 2013-12-16 13:37:09 | |
-- ---------------------------------------------- | |
CREATE OR REPLACE TRIGGER PlanningDistance | |
BEFORE INSERT OR UPDATE OF Distance, Jour ON Planning | |
FOR EACH ROW | |
WHEN (old.Competition = 1) | |
DECLARE | |
ExcPlanningDistance EXCEPTION; | |
BEGIN | |
IF (:new.Distance <= 200) THEN | |
IF (:new.Jour <> 1 OR :new.Jour <> 2) THEN | |
raise ExcPlanningDistance; | |
END IF; | |
ELSE IF (:new.Distance <= 1500) THEN | |
IF (:new.Jour <> 3) THEN | |
raise ExcPlanningDistance; | |
END IF; | |
END IF; | |
END IF; | |
EXCEPTION | |
WHEN ExcPlanningDistance THEN | |
RAISE_APPLICATION_ERROR(-20001, 'Erreur de trigger : 1'); | |
WHEN OTHERS THEN | |
raise; | |
END; | |
/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment