To all of you trigger guru's,
I am trying to create a database trigger that does an insert to a table called audit_parts whenever the standard cost of a part has been changed. I have never created a trigger before, and just wanted to get some input on the code.
Create or replace trigger audit_costs
before update on Part
for each row
when (new.std_cost <> old.std_cost)
begin
insert in audit_part
values old_std_cost, :new_std_cost, sysdate, :User);
I dont believe that I need to declare a variable to hold the old and new values , but I'm uncertain. Thanks in advance
David
I am trying to create a database trigger that does an insert to a table called audit_parts whenever the standard cost of a part has been changed. I have never created a trigger before, and just wanted to get some input on the code.
Create or replace trigger audit_costs
before update on Part
for each row
when (new.std_cost <> old.std_cost)
begin
insert in audit_part
values old_std_cost, :new_std_cost, sysdate, :User);
I dont believe that I need to declare a variable to hold the old and new values , but I'm uncertain. Thanks in advance
David