我尝试更新client_master表但是它给出了一个错误Idk why.I确实更新了client_master set name =' abc'其中name =' xyz&#39 ;;
create or replace trigger client_audit before update or delete on client_master for each row
begin
case
when updating then
insert into audit_client values(:OLD.c_no,:OLD.name,:OLD.address,:OLD.bal_due,'upd','1',sysdate);
when deleting then
insert into audit_client values(:OLD.c_no,:OLD.name,:OLD.address,:OLD.bal_due,'delet','2',sysdate);
end case;
end;
/
答案 0 :(得分:-1)
试试这个解决方案。希望这会有所帮助。
CREATE OR REPLACE TRIGGER client_audit before
UPDATE OR
DELETE ON client_master FOR EACH row
DECLARE
BEGIN
IF UPDATING THEN
INSERT
INTO audit_client VALUES
(
:OLD.c_no,
:OLD.name,
:OLD.address,
:OLD.bal_due,
'upd',
'1',
sysdate
);
ELSIF DELETING THEN
INSERT
INTO audit_client VALUES
(
:OLD.c_no,
:OLD.name,
:OLD.address,
:OLD.bal_due,
'delet',
'2',
sysdate
);
END IF;
END;
/