几天前发布了一个问题,并成功让我的触发器工作!但是遇到了一些新问题。
我有两张桌子:
CREATE TABLE "ASSESSMENT"
( "ASSESSMENT_NAME" VARCHAR2(50) NOT NULL ENABLE,
"DEADLINE_DATE" DATE NOT NULL ENABLE,
CONSTRAINT "ASSESSMENT_PK" PRIMARY KEY ("ASSESSMENT_NAME") ENABLE
)
CREATE TABLE "ASSESSMENT_ANNOUNCEMENT"
( "ASSESSMENT_NAME" VARCHAR2(50) NOT NULL ENABLE,
"DEADLINE_DATE" DATE NOT NULL ENABLE,
"ATTENTION" VARCHAR2(500) NOT NULL ENABLE,
CONSTRAINT "ASSESSMENT_ANNOUNCEMENT_PK" PRIMARY KEY ("ASSESSMENT_NAME") ENABLE
)
我的触发器:
CREATE OR REPLACE TRIGGER "TEST"
AFTER INSERT OR UPDATE OR DELETE
ON ASSESSMENT
FOR EACH ROW
BEGIN
IF :new.DEADLINE_DATE >= SYSDATE - 7
THEN
INSERT INTO ASSESSMENT_ANNOUNCEMENT(ASSESSMENT_NAME, DEADLINE_DATE ,ATTENTION)
VALUES(:new.ASSESSMENT_NAME, :new.DEADLINE_DATE, 'DEADLINE IS 7 DAYS OR LESS!');
END IF;
END;
插入在表格中正常工作。但是,当我更新ASSESSMENT
表格时,表格中会插入一个新行ASSESSMENT_ANNOUNCEMENT
- 它没有更新。
从表中删除会从ASSESSMENT
表中删除行,ASSESSMENT
但不会从表中删除条目ASSESSMENT_ANNOUNCEMENT
。
任何帮助和/或指导都会很棒!