我创造了
CREATE TRIGGER TRIGGER_CONTROL_ABSENCE_CYCLE
BEFORE UPDATE ON DEPARTMENT
REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW
BEGIN
FOR REC IN (
SELECT D.ID, D.ID_PARENT
FROM DEPARTMENT D
START WITH D.ID_PARENT = :NEW.ID
CONNECT BY PRIOR D.ID = D.ID_PARENT
)
LOOP
IF :NEW.ID_PARENT = REC.ID THEN
RAISE_APPLICATION_ERROR(-20000, 'Cycle in hierarchies detected');
END IF;
END LOOP;
END;
给出错误讯息 [42000] [4098] ORA-04098:触发无效并在验证时导致崩溃
(我不懂英语,所以我通过翻译翻译了它)