我如何编写 Oracle 触发器,而不是当用户删除某个记录时,删除实际上并没有发生,而是对这些行执行更新并将记录的状态设置为“D”?
我试过了:
create or replace
trigger DELFOUR.T4M_ITEM_ONDELETE
before delete on M_ITEM_H
FOR EACH ROW
BEGIN
UPDATE
M_ITEM_H
SET
ITEM_STAT = 'D'
WHERE
CUST_CODE = 'TEST'
AND ITEM_CODE = 'GDAY'
;
raise_application_error(-20000,'Cannot delete item');
END;
但是我遇到了变异表错误。这可能吗?