我有一个触发器,我想通知用户而不阻止他/她继续进行。 这就是我现在拥有的。 我尝试了很多不同类型的SQL状态,但似乎没有人这样做。
CREATE OR REPLACE TRIGGER DEAD_SAT
BEFORE UPDATE OF TRAILER ON TRIP
REFERENCING NEW AS N
FOR EACH ROW
BEGIN ATOMIC
DECLARE DEAD_SAT VARCHAR(10);
SET DEAD_SAT = COALESCE((SELECT TRAILER_ID FROM TRAILER WHERE LAST_SAT_DATE < CURRENT_TIMESTAMP - 8 DAYS AND N.TRAILER = TRAILER_ID),'NO');
IF DEAD_SAT <> 'NO' AND USER NOT IN ('VISTAR','TM4WIN') THEN
SIGNAL SQLSTATE '01000' SET MESSAGE_TEXT = 'SAT ON TRAILER IS DEAD. PLEASE GET IT REPLACED.';
CALL SYSIBMINTERNAL.SQLEML_RAISE_ERROR(438, 'SAT ON TRAILER IS DEAD. PLEASE GET IT REPLACED.', NULL);
END IF;
END