CREATE TRIGGER ci_insert
AFTER INSERT ON tb
REFERENCING NEW AS nr
FOR EACH ROW
DECLARE
date_from DATE;
date_to DATE;
diff NUMBER;
BEGIN
SELECT DATE_FROM INTO date_from WHERE id = :nr.id;
SELECT DATE_TO INTO date_to WHERE id = :nr.id;
diff = date_to - date_from;
UPDATE TB SET (diff) VALUES (diff) WHERE id = :nr.id;
END;
我使用 sqlplus,但它不起作用。它甚至没有显示任何错误。会是什么?