我有这个触发器:
CREATE OR REPLACE TRIGGER trig_update_process_info
AFTER INSERT ON rocessstep FOR EACH ROW
DECLARE
audit_time TIMESTAMP(6);
found_flag NUMBER DEFAULT 0;
BEGIN
SELECT MAX(lastupdatetime) INTO audit_time
FROM processinfo
WHERE instance = :new.instance;
EXCEPTION
WHEN no_data_found THEN
found_flag := NULL;
IF found_flag IS NULL
THEN
INSERT INTO processinfo
VALUES (:new.instance, :new.step, :new.status, :new.iteration, :new.audittime);
ELSE
IF :new.audittime > audit_time
THEN
UPDATE processinfo
SET step = :new.step, lastupdatetime = :new.audittime, status = :new.status, iteration = :new.iteration
WHERE instance = :new.instance;
END IF;
END IF;
END;
但它不起作用。你能告诉我这个触发器有什么问题吗?
这是目标表:
创建表进程信息( 实例字符(36 字节)不为空, STEP VARCHAR2(128 字节)不为空, 状态编号(*,0)不为空, 迭代次数(*,0)不为空, LASTUPDATETIME TIMESTAMP(6) 非空 );
谢谢